- is6 a- C# G& q; Z5 M& f
- r:real; file:string;5 O7 @+ ~, R7 v7 k* Y
- do
' r4 w$ l% B' d8 s - openConsole;
: @: X- y% \ C. o7 j3 H) y. o' Z
5 b% G$ g: @, j1 z+ O, O2 D- /*
& w7 {2 ^6 f2 i - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
: s$ ~) p& j- N3 B2 A - when is64BitApplication then 64 else 32,9 J2 B+ d; H6 j& q( {6 q
- "bit.dll");5 ]/ e* }; F( @
- */+ Q- a' L# q5 Z4 ~3 Z/ h4 ?- m" N3 e
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";2 j- s! T: U. t! i9 Q+ F
- local j := loadLibrary(file);, X! d$ h+ [9 \0 t9 ]# r/ i! }6 }( Z2 u
- 0 a% T K" G9 D! \8 E1 G
- if j > 0 then
. o: E9 F! }: ]) ~ - print getLoadedLibrary(j)," is loaded.";
& R& j3 z9 ~2 Z& W' |* a
9 _6 M& I% f4 t9 T+ \- r := callLibrary(j, "calcSin", PI/6);, [2 H7 p$ k! q
- promptmessage(to_str("sin(PI/6) = ", r));
' ~2 R4 K1 g' Q7 } -
3 P( H& o* u+ Y; G$ k - local str:string;6 y! N$ x8 p9 w8 W( Q4 z) x
- str := "I'm OK!";
2 f1 X, A0 p4 O- E/ c5 L1 N) n3 ? - str := callLibrary(j,"resetStr",str);- r. N9 S4 K" N2 | C' G
- promptmessage(str);+ }# B ?8 T* f# i* B1 W5 |2 m
-
3 U6 P0 a' I+ N - callLibrary(j, "listAccess", Tablefile);
* h, [$ W& X9 s+ {) W -
* S1 Y% k/ m7 Q* W7 o - print "Unloading: ", freeLibrary(j);
5 G) S9 j4 x0 ^: ^8 P0 o - end;4 E0 G$ c* M/ R$ ]; [! H) e# s
- end;8 E+ R( q p0 U' R1 {& B
复制代码 |