- is
7 w5 r& E/ R6 v# K. M) | - r:real; file:string;7 W* C9 s6 [+ B; G& w4 R
- do3 I, z- P ^1 K3 ]
- openConsole;
/ g) g6 j+ Q$ l7 W+ P. m. J' u7 l
& ]+ c; B8 f* a1 e2 c; s z- /*; c, g R9 `$ @7 F' [ _% N5 X
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
6 [& }; q* Z% X' P - when is64BitApplication then 64 else 32,
& A5 C5 G, B9 g9 S% P. Z - "bit.dll");, b& U* G. b w
- */0 P# I2 i) Z" a0 {
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";& y9 r: b* g* f' ~
- local j := loadLibrary(file);* b4 ^; D9 K) u
9 ?4 M# I9 [# }, p! G- if j > 0 then
- ]3 F( }( \ u2 Q - print getLoadedLibrary(j)," is loaded.";; u; c0 s! O1 |: [
/ O* x4 ?3 X! d% Y+ L- r := callLibrary(j, "calcSin", PI/6);8 h/ n. p# V9 |/ O6 z1 X' }+ R, J6 _
- promptmessage(to_str("sin(PI/6) = ", r));+ i4 c( b" }' N' \/ ^8 t
- # b4 ?! M$ z/ M( i: A9 F9 k2 }. B5 Z
- local str:string;
& c3 C1 P. r5 b - str := "I'm OK!";: A5 u* I( F+ K% Q% k& z
- str := callLibrary(j,"resetStr",str);
" n+ q4 |/ T; C% b - promptmessage(str);$ [ c6 R/ C k' b4 i8 l+ A
- , c* D7 k2 w+ E- G' v
- callLibrary(j, "listAccess", Tablefile);
% a* I7 ~& ^+ L- l1 Y! M& C. M -
0 L9 L' v* c8 c: g - print "Unloading: ", freeLibrary(j);
( H1 X3 d- O6 M# G' r* W - end;
; P y9 r$ \$ `, T) @ - end;- S0 l3 A& u8 [6 x* `, ?2 ]
复制代码 |