- is& _5 x4 K8 P9 R' [
- r:real; file:string;2 o# P R8 n' x6 B5 _# p
- do
& S( ]2 l0 q. L" ?$ C9 w - openConsole;
* b! z- k8 K) j: j9 K! K; y
2 Q& l) Z' r" p8 K! p0 o1 n- /*
. F4 S `: |- o" L; ? - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
: S5 C$ }# y3 }9 Q6 e( O% m - when is64BitApplication then 64 else 32,3 I$ s! B( D. }2 w! [8 S" b
- "bit.dll");
1 S4 e0 p% `, O5 w5 b - */
2 @9 d I! j" D+ S - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";0 v6 Z2 P3 e4 h0 b* q
- local j := loadLibrary(file);6 v. G6 i% z6 x, O
( J* G% i8 l) c* F4 E- if j > 0 then6 `6 |! j' P" P7 w3 ]/ B% d9 h9 X% u
- print getLoadedLibrary(j)," is loaded.";- }5 R1 i b; v, v- P J
$ n0 B2 Q2 z/ ^2 b% \0 L# `2 c: x- r := callLibrary(j, "calcSin", PI/6);
/ g" f9 {- c; j. [2 T: n - promptmessage(to_str("sin(PI/6) = ", r));
- G9 T2 g6 M- |$ }5 f* n -
0 K f$ s( i* k2 C - local str:string;
o6 c" W) p- P7 e6 d7 _ - str := "I'm OK!";
) R, _' ~9 u1 d8 G' H - str := callLibrary(j,"resetStr",str);
6 s) D# j! K4 X/ y- H2 _- w! d - promptmessage(str);8 Y& T9 r" ^% f1 s
- % l. T X- i# K) `) v
- callLibrary(j, "listAccess", Tablefile);
; @2 x" X+ J+ G0 M6 g - 2 q- p9 I" P! E* l. d$ w% U2 C8 P. a
- print "Unloading: ", freeLibrary(j);
' e: y# f/ Q% y7 Y, D9 E+ d - end;: X3 y: X9 q$ }: M
- end;) u0 I; H+ ^3 Z8 o" R5 C4 X: y ?
复制代码 |