- is
& E' a+ Q) N- ~: g - r:real; file:string;; q- H# K* Y( c9 L0 G. C5 k
- do1 A6 e6 ~; P) X3 L% i
- openConsole;
8 w( i, N7 d# e4 Q8 S, W' K - ' c5 |! e2 F1 `( A1 ~3 k. x. L% L
- /*7 y3 m; I% }1 o, l/ K/ n
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",, D6 m) h' E6 z
- when is64BitApplication then 64 else 32,& J9 [; W" W8 a" @
- "bit.dll");
8 _& j; F( {+ X; L9 V8 e, p, y/ S - */* e6 o% N. s: h0 A! e
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
' I P/ e& i0 d1 }0 [" H; b, h6 M! U - local j := loadLibrary(file);% a5 s; W5 S8 U) O, u8 `$ A
- : w; q, n) _0 R9 H& _- }, {+ n
- if j > 0 then
/ t5 Y* l3 \0 L' C, C( |: o- h - print getLoadedLibrary(j)," is loaded.";$ D; [% o& Y3 Z( V D" V/ K
( i3 a8 B2 w! `' g1 P' Q. P- r := callLibrary(j, "calcSin", PI/6);5 z$ D! b0 v6 q3 G
- promptmessage(to_str("sin(PI/6) = ", r));
( p z' p5 Z- C* Z+ | - : I, P% I8 w0 e2 B: q
- local str:string;; i" b+ l: _0 }1 k2 g, v
- str := "I'm OK!";
0 ?5 U3 @' P$ _; v - str := callLibrary(j,"resetStr",str);6 _( d' v, O e, u
- promptmessage(str);- P* q8 ]9 n1 ^/ w
-
. n3 C; }3 G# C$ k7 C - callLibrary(j, "listAccess", Tablefile);: l0 \2 S( F" {5 g/ H1 l2 ?
- ^4 a, Z! ~; N+ b6 U$ P
- print "Unloading: ", freeLibrary(j);
) O3 [4 h: h. G( m+ t% A8 o7 ^ - end;+ E7 x/ J. T8 P) D# n# e' v d
- end;: E' s& A/ T; A: R% f1 ]: x3 |
复制代码 |