- is
$ L6 O1 E9 J( V - r:real; file:string;6 s: {: v+ p6 G# Q, b
- do5 | g$ Y- Q1 B3 z; v' A( b
- openConsole;
* k3 @/ k) [2 q% I G
$ z& G4 b5 \- T) g! B3 ]( J- /*; A) Z, y* v9 R
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
7 s- ]. A# q) M# f7 d* ~2 Z - when is64BitApplication then 64 else 32,# Z \6 Q/ m" R0 _ s
- "bit.dll"); Q/ W! e. \: e" b& x2 u
- */
& t4 i, z$ H3 U" E# z. B$ l - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";7 k% ?! J* e4 J7 l% N; k3 G
- local j := loadLibrary(file);
6 I3 L7 |: J; C! y+ w - . f. B- p1 L( H' L5 i4 q
- if j > 0 then
) W9 } b% L/ V# @+ B, T' H) s" I - print getLoadedLibrary(j)," is loaded.";
X& |$ ~& }5 T3 b5 w# u% @ - , [0 P) D: s' y1 v
- r := callLibrary(j, "calcSin", PI/6);
) a a! \- Q- A4 t, c# u% g* p - promptmessage(to_str("sin(PI/6) = ", r));* R1 n m: X! F. {8 n4 Z1 I
-
4 V1 t" S3 }4 O/ ~" L - local str:string;' W* O4 z6 `7 Q) f8 O1 W5 x
- str := "I'm OK!";
% H l' x+ g! ]6 E: @# M - str := callLibrary(j,"resetStr",str);
3 g5 d% E6 q" W - promptmessage(str);
9 v1 r- V$ ~! _0 v' |: c& } - 3 z0 U% M# Y2 `+ A6 G7 A
- callLibrary(j, "listAccess", Tablefile);
5 z+ B. I9 [, P; U! C# H - ' |9 N4 y: g( x- ]+ J; Y3 J# a
- print "Unloading: ", freeLibrary(j);# E9 P/ H/ W9 u3 I& t; ~* |
- end;
. s/ ]: b/ ~; o! F - end;! [% T7 R/ a3 Y. s+ Y1 l
复制代码 |