- is: K5 i' ^5 ]$ Q; I2 C
- r:real; file:string;
8 z+ |7 T- X/ {5 a: B* L - do* B# }: n2 B4 F6 B. X3 y- Z! D
- openConsole;# @) F. n# G( H) m) W
* @% [6 N% J1 O1 J8 ~* ~2 ?- /*
2 R8 ]/ x/ B% L - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
) ]1 d1 X/ d A4 b) g! J; U: z+ z - when is64BitApplication then 64 else 32,1 Q" F5 [# T5 i, b" [) {5 g
- "bit.dll");$ A$ ?0 a* y9 m! B" ` D
- */& e! w& V/ i9 r; D! g
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
3 h- V) W2 H0 F/ a# ] - local j := loadLibrary(file);9 q( v5 n' C! Z4 d+ v
- 6 Z' G% a; _+ F5 v4 h. }/ W
- if j > 0 then6 v1 S% f* p, T7 n( J2 O
- print getLoadedLibrary(j)," is loaded.";# z/ ~; l4 J' l: Z6 ]
9 w" C+ B2 u" M- r := callLibrary(j, "calcSin", PI/6);# n* T) W- \- r/ f; e( l# }
- promptmessage(to_str("sin(PI/6) = ", r));( u7 Z4 l/ f; c* x. G9 B: X
- 3 y5 H4 e+ A8 N! A
- local str:string;, Y, k' |/ _# R8 \1 \
- str := "I'm OK!";0 n7 S' I7 N( c+ e1 J- m2 Y
- str := callLibrary(j,"resetStr",str);
# A: d) M5 I& ?% { - promptmessage(str);
5 Q' N' j' ]* b -
$ ]& n# [- m0 x, G6 x - callLibrary(j, "listAccess", Tablefile);1 ?; O1 ^9 y' I$ [& x
-
" z. V& U& m8 c- k - print "Unloading: ", freeLibrary(j);
% a4 l! e, {) }! H5 C - end;0 \' `! s1 R9 t3 A* s/ N6 M
- end;, a5 o! ]% u. |( z+ y' R( J8 t& k- u
复制代码 |