- is2 W5 P$ J; ~( B7 \
- r:real; file:string;
6 e) q$ H, T- e6 N - do* h9 _* g* Y9 u2 M
- openConsole;% v+ x6 i) |' Z% k1 c0 |
- ! A+ |4 z3 P# V' N
- /*- P. ^' _' W7 _9 _9 h: X w
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",0 d2 R; w7 v8 ]9 ^4 t$ _9 K
- when is64BitApplication then 64 else 32,
! y8 v' u1 A& H1 l - "bit.dll");3 p& y* R8 E" Z3 _( A' ]
- */
) F2 v$ @& ~( U7 ?8 `' N7 } - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
6 e0 h7 `- X! v - local j := loadLibrary(file);7 i9 O) s d4 h/ I! N+ d1 b2 [- p% w3 i
' L- X* J/ K; K: u6 o- if j > 0 then# M- z& i4 o' o4 O/ [& F0 Z+ U
- print getLoadedLibrary(j)," is loaded.";# T6 R2 {" G. Z/ M' f* j9 E O" Q
- * r! }( t; u( v! w3 ~
- r := callLibrary(j, "calcSin", PI/6);
. m3 K' _) ^; ?- y/ r. Y - promptmessage(to_str("sin(PI/6) = ", r));
t9 x- r" E- Q+ ~) k -
- V: e$ ^ G! S$ Q' M9 B2 z - local str:string;% [, [' |: k9 B4 G' {
- str := "I'm OK!";
: Y/ ]# M. t# \) o T - str := callLibrary(j,"resetStr",str);
4 |& A4 H r( A6 k. l9 G - promptmessage(str);2 Q4 Y/ ?. Y$ I5 w( N- F% S
- ! I3 y4 Z5 `0 H" |" r7 D6 ]3 `, b2 }
- callLibrary(j, "listAccess", Tablefile);7 V5 I0 ?' [2 y6 I8 X
- 7 [+ ^+ p2 t; x) }- i+ Y
- print "Unloading: ", freeLibrary(j);
: W; P* d Z6 u! M$ | z3 F - end;
$ L w# U( J1 J - end;
# `/ R* r1 ~* H+ ?1 o3 P4 x5 s
复制代码 |