- is% @1 u; e+ z+ p3 o! t
- r:real; file:string;
' s: y4 ]6 v8 I: V3 y! I; q' L5 K - do0 M6 ^$ _8 h; t: S$ J! [
- openConsole;' d6 n2 D4 ]4 d( ~9 L. |3 o
- % n% ?7 _8 r: x, U
- /*
) I# y5 f6 c( C" }) ~+ m, w - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
- P5 p' B8 a- a' w% f* | - when is64BitApplication then 64 else 32,
- ] Q6 j; R- ^- E - "bit.dll");
2 s5 h% Q5 e7 F' g9 ?. g+ c - */& F3 M0 u3 f: B* w
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
' s8 r* Q% V. }: p8 L. q6 I* \ - local j := loadLibrary(file);
]. C4 V3 m, t" M( k - ' [, z: U) Q$ y8 |) ], n
- if j > 0 then6 s! s/ u0 @: E8 D% D
- print getLoadedLibrary(j)," is loaded.";
4 X5 [% |* Q; C: u- H k" A
[: y6 G7 n$ J+ Z5 S9 S- r := callLibrary(j, "calcSin", PI/6);$ O t7 M+ s, z: Z, }
- promptmessage(to_str("sin(PI/6) = ", r)); A. V; S9 y. F2 ?4 a4 n
-
, p5 E% T) d* F$ P& m! q - local str:string;3 `4 N* s: Z% P7 h* k0 L5 S
- str := "I'm OK!";$ _! j! r6 a. \: L' z
- str := callLibrary(j,"resetStr",str);
# j5 J D/ Y3 m' Y/ e - promptmessage(str);
" e |/ [9 Z: }5 Z - ( `# n# C# g, z) F2 g: |6 a) V
- callLibrary(j, "listAccess", Tablefile);! y3 q6 w2 V% f. {* B' f" m. q
- , h x! r L1 p* c
- print "Unloading: ", freeLibrary(j);
, k1 k' P, x f2 ]- p$ ] - end;! W D7 ]# g d/ Q
- end;
# Y8 v: q m/ q) N9 M
复制代码 |