- is: j3 E$ D5 ^& j: w* G6 F
- r:real; file:string;# l9 n6 P9 Q/ Q+ V$ g
- do; j! [! O& W3 F* G
- openConsole;
) O9 }5 C" C, v6 t - 5 |6 F7 o6 f+ M" m$ b$ k- r5 `
- /*2 Y/ Y5 ~9 M2 p; V% Y, O
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
9 b3 b# d" k* J) ]3 W; o4 m - when is64BitApplication then 64 else 32,, b! J/ u8 g# ? y
- "bit.dll");
$ j/ j: V& x3 d* Q - */
. e4 P/ a7 V1 n" F) s& _ - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";, ?5 ~2 n8 l( s+ F( { s
- local j := loadLibrary(file);3 n! u* C" k+ b1 c6 p
$ r! A9 x T0 X% `3 ^- if j > 0 then7 {) x' o/ j8 R! c9 C& b
- print getLoadedLibrary(j)," is loaded.";& E8 m5 i4 r4 @7 M- X0 |1 q" e
" ~* S1 h; f$ G C4 m- r := callLibrary(j, "calcSin", PI/6);
8 m' Z( U7 G/ Z, {& G7 H8 {9 z - promptmessage(to_str("sin(PI/6) = ", r));4 C$ V; i* ~5 }' a' ?+ k
- ( B) Y4 y( P/ ~4 U2 d
- local str:string;
/ t# E1 l/ _3 `( c7 f" v - str := "I'm OK!";
% O/ e6 Y N/ H5 Y0 K - str := callLibrary(j,"resetStr",str);
" ~) i# j& ?, y* s, ]8 l D% R; ^9 _& q; e - promptmessage(str);$ I6 y, x. u% {
-
' c4 o" W" ~6 U: A: O, h% Z3 m - callLibrary(j, "listAccess", Tablefile);
% y) _( c( _3 K/ a* v% e -
- } ~2 U; Q& N% k - print "Unloading: ", freeLibrary(j);2 J) @5 a6 K3 o7 A
- end;
8 A; V0 F0 m9 {# O" W - end;2 M: K- ~9 m X& [0 p
复制代码 |