- is% g9 N$ y8 R8 {7 e+ ^: q7 _
- r:real; file:string;' {; h8 L& \6 {# X
- do2 l; p4 A9 N9 y4 f4 V; Q) V
- openConsole;) X% ~5 ?- Y& O/ i! n
7 E. o& h3 u, d- /*0 m9 j& v5 ?" {
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",# S! Z. e/ c V) J/ T
- when is64BitApplication then 64 else 32,
$ n! E/ _9 Z: C. C% ^) Z - "bit.dll");
! Y; J7 W1 G# a' p" P/ \ - */1 {7 o7 K5 [7 d+ k
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";. D1 N9 n0 @( v( v
- local j := loadLibrary(file);
" [3 S% l' u/ t - 6 l0 M" C, I) X0 `) S5 O
- if j > 0 then
9 l) G! j5 z' s - print getLoadedLibrary(j)," is loaded.";
6 z0 g1 E5 L) ^! x0 ` - * B; d9 f4 `. N5 c
- r := callLibrary(j, "calcSin", PI/6);
+ u. k1 d% b( K - promptmessage(to_str("sin(PI/6) = ", r));
' q7 e3 R" _& v" B0 V" F& }' J& f+ ] - / H. F' o$ D$ ~& m
- local str:string;* L# f/ Z- \, U! ~" I9 x+ R$ i6 ^/ D) p$ ?' g
- str := "I'm OK!";
, A. M- ]* F- f3 g - str := callLibrary(j,"resetStr",str);% f) N0 Y: C% U) m5 D/ Y6 G
- promptmessage(str);
/ n4 N! y( s: R" z: V7 P - 7 H' J- g: e4 q1 y1 b5 }
- callLibrary(j, "listAccess", Tablefile);& r# I/ }' k9 [4 r, L
- & q; C/ I$ u7 c2 t+ p' a: B
- print "Unloading: ", freeLibrary(j);& W2 _. d" g \2 N4 W+ ^: S
- end;! Q2 s7 ~5 ~% @! l; n# L4 O9 H
- end;# x6 `$ v+ ~2 D6 E# v9 _ v
复制代码 |