- is. Q" o- v9 {) }( r$ M: v* f1 n6 g
- r:real; file:string;1 x3 u% F7 w/ l1 h" O, d& y& y
- do
) ~8 g6 ]1 N. }6 ?6 o& d7 X - openConsole;
2 D* [) k6 H: a; H2 u
; N2 p6 Q# y* c8 H- /*0 L) P: j1 k8 B2 L
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
9 g- q; A3 N$ `1 m, } - when is64BitApplication then 64 else 32,
- ~* f) O! n3 } N2 B- Q - "bit.dll");$ y% V$ a/ c3 W1 n: h; Q
- */
8 C7 ?6 @1 E4 A- t- b - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
7 V- j- q1 e/ u! i, J - local j := loadLibrary(file);
5 G h6 o9 x* |; g - # w% ^% C g/ l. m
- if j > 0 then( H+ Y. l1 j6 z' J
- print getLoadedLibrary(j)," is loaded.";- P6 g- s. z! r+ R# r
- 4 a5 w6 E3 {8 U4 H' P$ J" W
- r := callLibrary(j, "calcSin", PI/6);
/ f1 E# n/ [' b3 C - promptmessage(to_str("sin(PI/6) = ", r));
1 u) }: Q) z. x. \3 ]- [, F2 c -
( z8 f& ]4 _ a5 u- w0 o - local str:string;
* w3 \, ?" o3 l$ E7 ^ - str := "I'm OK!";) ^: \# l$ {) r: a* v; V: s
- str := callLibrary(j,"resetStr",str);
; c7 r6 @' M) p% K1 y1 f - promptmessage(str);
% e! E* q8 \ E( v5 n8 J -
; G8 D6 h8 z. S7 t/ @- ^& D - callLibrary(j, "listAccess", Tablefile);; \. E0 I# U- j: \
- & w7 a) f8 t( W$ z
- print "Unloading: ", freeLibrary(j);' R8 c- c, S" w" @# c6 d
- end;; c; g+ N- B% f5 m( f
- end;
: z) E, G. p' J3 @
复制代码 |