- is+ n. F# E% C* ]3 S& q$ V3 J( D
- r:real; file:string;9 B, R+ W: x& Z3 }5 r) b. v1 ~% v
- do
2 y/ T' x4 v1 S7 e - openConsole;+ R3 [- M1 U7 ?& p
4 R. G& F d$ f# w. }9 x0 B# N( _- /*4 A' |, q0 M0 \ `0 K" a
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
, P7 A: g I4 \! W - when is64BitApplication then 64 else 32,4 @3 O; u" F% Z) |' i
- "bit.dll");& J m: A: ^; S' ^
- */
' J* y4 b: v# E - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
2 v6 \1 \9 W; J; F - local j := loadLibrary(file);
- _7 Q% Q* U" S - & A% Y' q, R7 Z0 x4 e
- if j > 0 then
. T1 W. i6 g/ P$ b8 x. P1 Y- G/ I - print getLoadedLibrary(j)," is loaded.";# _% K6 c% B4 h- H0 j- p7 \
]+ _, @/ |; ]" r$ D- r := callLibrary(j, "calcSin", PI/6);1 Z, Z% S* Z" a; {, L
- promptmessage(to_str("sin(PI/6) = ", r));. J- m! K8 n7 F. s. V/ l
- ( ?7 Y3 e+ Z2 [; n2 X, [
- local str:string;
* \2 `" k) q6 T6 \) e& h+ E3 c4 J - str := "I'm OK!";: a% D7 G) u; g! _6 E3 c! u
- str := callLibrary(j,"resetStr",str);3 C" |, W# _, c7 q7 ?
- promptmessage(str);- T, G3 B! d4 Z
-
& m* R8 ]: y- n2 Y! l. P7 x7 |0 U - callLibrary(j, "listAccess", Tablefile);
1 g4 _( m5 j2 ~$ h2 [1 m - 2 z( }9 K& D0 G- N7 D2 y
- print "Unloading: ", freeLibrary(j);9 C% i3 ]/ ]6 s# u
- end;
0 \+ [7 ?' {( v( j4 ]4 O - end; `/ ^1 g' S' J! }) R
复制代码 |