- is
( ]& D9 i. G: P - r:real; file:string;
5 @4 e. ~8 O/ U0 C5 V: U. { - do
# W8 K; s/ }+ e% j1 p - openConsole;( C o. V6 J6 d/ J
& q5 d. w3 W) p4 S8 c# x) r4 _- /*" ?3 O/ o0 l9 H& L' g, t8 I
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
( R1 S1 x& ^- w' n; | - when is64BitApplication then 64 else 32,
9 f! X5 B% P% M9 v. o9 H' X% f7 z - "bit.dll");- ?# I9 T \ Q
- */
. K3 [- J& H4 L. f5 y/ ]3 I - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
R" z- \2 s: S7 ]- V; p - local j := loadLibrary(file);
3 f0 X9 c; x( Y1 V2 n, j - / X: u( F: y5 h* l
- if j > 0 then
- f7 |, ` K3 R8 B7 r - print getLoadedLibrary(j)," is loaded.";3 g6 m8 |4 K# J( w& x
( M s* F) E% D' M# a9 Q/ G6 @- r := callLibrary(j, "calcSin", PI/6);
p* }# _* W- `( I - promptmessage(to_str("sin(PI/6) = ", r));7 `2 D8 H! M. V$ J
-
2 G/ A5 B1 a4 W0 z/ s; z - local str:string;- k% i6 f8 W2 d
- str := "I'm OK!";
0 p V; n/ d) C8 _2 v" l0 S - str := callLibrary(j,"resetStr",str);
! {0 A# ?6 r j6 y! v5 e% B/ E - promptmessage(str);
$ l% P* g3 _0 y5 `" s0 B - + D! G# E9 D5 m% K7 m5 y" a
- callLibrary(j, "listAccess", Tablefile);
& \) s3 U1 r5 \, c -
9 l6 v* Y" s# T" ~ l - print "Unloading: ", freeLibrary(j);3 _9 b7 G9 x3 W
- end;. {* j. c5 o9 x( { _* j+ d* f
- end;
! M5 }' @4 i- w/ ^! C$ [% s
复制代码 |