- is
. g+ K$ ^1 g w2 d" i& Z - r:real; file:string;6 I" } Q7 R7 X+ [9 r. b0 F( u
- do
2 i- L% m8 @, v - openConsole;- `, W% o. A$ z8 X- T* }
- G6 s, L. N F7 c ^8 t1 d" b/ K- /*
; g" X4 Y9 y6 Y- k7 d- W+ Q' _ - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
& [' V5 X% E1 p/ B/ a - when is64BitApplication then 64 else 32,
6 Y& [) J1 g- m/ z) u4 u8 P2 Z5 g - "bit.dll");" E' R/ k# |+ J$ P7 x
- */
8 b5 y% v7 N0 k - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
- d: E2 Z b, X1 ~8 c$ P) o% p - local j := loadLibrary(file); [. z6 f/ J; H$ B; i
) T- x, K2 I/ y3 N7 d3 j8 l: q- if j > 0 then4 ?& I# m) b) a" t1 L% R8 ]- c6 c! R$ r( V: a
- print getLoadedLibrary(j)," is loaded.";2 y: D7 R+ y8 D
. a" m+ w% _$ h+ b0 l) @1 m- r := callLibrary(j, "calcSin", PI/6);/ i& F6 d3 m' }' E( Z
- promptmessage(to_str("sin(PI/6) = ", r));
8 c9 d- j" D5 n. V# g; T3 ~ V; y - ) i/ L- }4 \ z" ^1 d0 `% I% R
- local str:string;- ^' j' p/ g3 d2 N0 Z& L7 F
- str := "I'm OK!";
) o) c8 y( y3 }1 U7 \4 [ - str := callLibrary(j,"resetStr",str);" W8 L: h: g) ^7 D6 ], n/ a
- promptmessage(str);; N% l. g( k2 q
-
; W, M ^, f4 c1 L% | - callLibrary(j, "listAccess", Tablefile);3 Z* g+ J/ k3 H% K3 L' C; S
-
$ @) c v) X+ y; {( X, O1 E - print "Unloading: ", freeLibrary(j);
; J# Q) @1 c; N% h, n8 W - end;" v1 n+ _( @! y* N _
- end;
. R! k, Z; Q$ x3 c
复制代码 |