- is
& Z: g5 w$ m- {# t) o% V) y! c - r:real; file:string;
2 |, s! ^( a- u2 c% n - do. o- i/ ?9 e/ { |0 c
- openConsole;! t! E0 B: a) K& }% F4 b7 `
- 8 S3 z; o' n3 K; q
- /*
: B" `1 `/ W' Y; [ - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
/ F6 e% d. {8 X0 s- S - when is64BitApplication then 64 else 32,+ W0 e2 M ]! y5 H
- "bit.dll");& F4 n: F) E' Z! ^
- */6 b: D& h5 r6 b! \+ O9 b' }
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
2 K& B' H |% M' g1 n5 v: V - local j := loadLibrary(file);1 B3 g( r3 v5 }- B: I7 H
- & k) a% S1 j2 a1 x4 }
- if j > 0 then
/ I1 }0 A- q2 X0 H" R' y - print getLoadedLibrary(j)," is loaded.";8 j! Q) e+ R+ h' Y! q9 X
- 6 B% C, U' D/ X& E* Z
- r := callLibrary(j, "calcSin", PI/6);
4 j/ K0 q; O6 P - promptmessage(to_str("sin(PI/6) = ", r));
3 n, y- ~6 T% ^, O2 P% b - : O! F' O. M; f& j) H K* Q/ u
- local str:string;
I3 V5 b5 M% X - str := "I'm OK!";
- F6 ^4 B3 u2 _4 ^# d+ S/ w: D - str := callLibrary(j,"resetStr",str);
, _! |. f, U Z& N0 Q - promptmessage(str);* _4 S v/ ?9 V* I5 W$ _4 }7 Y
- + i A! h# }/ g4 W' |6 C3 G! \
- callLibrary(j, "listAccess", Tablefile);
; }1 ~) p& W3 q" l- z: H! ? - ) P; m5 n3 d9 ^( }. ]6 f5 {
- print "Unloading: ", freeLibrary(j);
8 K* U/ ^: R$ U x - end;
2 @" e% k2 s, E, I; B+ ] - end;
- t4 s/ C- ]7 @7 i, k
复制代码 |