- is: [& s. F0 N/ o: j5 U8 W
- r:real; file:string;0 A8 ^! Z" |1 A9 I/ }
- do) _5 W2 Z p- e
- openConsole;# }* R x- W, J4 K x! y
8 V1 J- Z4 B1 w4 z! a- /*1 _) ]) Q3 P# ~/ _$ H
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
& L; ^' e" z/ G! }2 J% f d! N' f8 @ - when is64BitApplication then 64 else 32,' w( }$ D7 p# T. x
- "bit.dll");7 H9 {2 d* V1 L8 f
- *// M% n' W! F- R1 v" }
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
7 k( m$ L7 f# f8 ?. ^# U- g( m/ j - local j := loadLibrary(file);; n e4 o" {9 E9 G8 ]
) S% i* {5 [9 ]- y8 K- if j > 0 then3 G' _# H) T/ H9 x
- print getLoadedLibrary(j)," is loaded.";- R- m6 I# _& S o& y4 Y" c3 D
9 F* V3 ~- E Z5 p- r := callLibrary(j, "calcSin", PI/6);" W `; U8 B7 k! c6 O$ j
- promptmessage(to_str("sin(PI/6) = ", r));
- p6 N' O& r4 U/ O2 E -
+ t6 g' y% g* N# z' | - local str:string;2 U& v' t3 R5 \' p* K6 _1 K l
- str := "I'm OK!";
, q8 x5 q, g$ _ - str := callLibrary(j,"resetStr",str);
* ?# J1 _4 D$ n1 h9 s- f/ Y& f3 a - promptmessage(str);" ?& u) B; y: u0 W1 T
-
) v1 `1 E" x7 K* n7 j/ F - callLibrary(j, "listAccess", Tablefile);
/ D/ o0 K/ i( N -
$ ]3 _ [2 n, d; U0 q8 ^ - print "Unloading: ", freeLibrary(j);
4 ?; S: F$ c5 |& J: k+ f4 P6 L - end;
0 h2 O: ]+ ^2 F8 b: O3 A( @* F - end;" J) U. j- H2 u; s5 ?
复制代码 |