- is0 J* P/ E( b ~) G; r/ V
- r:real; file:string;# _- r3 R$ r9 o( a0 C: r* W" s. C
- do
& C+ O1 \. [$ V& d - openConsole;
/ I5 d+ o k. \5 g A- ]' Y6 Y - 9 }( G9 b6 n6 _3 @' D+ d, _. E
- /*, ?1 i9 D K) ~ k/ P7 n& H
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",. v3 E/ g7 o) A2 K0 y
- when is64BitApplication then 64 else 32,
; f" F/ k, n! L - "bit.dll");5 X1 w% c+ C5 t! D( a) O8 u
- */
! h# R5 X# X# f; \4 e - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
" M! T+ a" v, x h& w; G/ j - local j := loadLibrary(file);
$ e! O" y+ g! y& x3 a: X2 {
+ L" p+ Y9 ~& ?7 Z- if j > 0 then
( t2 A: \+ g! _6 X4 A* r9 ?* _$ d3 u - print getLoadedLibrary(j)," is loaded.";' {6 E& [) @3 V
- 5 i$ K+ N. @# E- `
- r := callLibrary(j, "calcSin", PI/6);
) W3 x' Y8 n' Z# Y - promptmessage(to_str("sin(PI/6) = ", r));# ~ C3 N2 O3 W6 v- g7 J
-
( A+ V7 f3 A( o+ X6 u( @ - local str:string;6 b% x. g! Q( q
- str := "I'm OK!";2 s% v2 w. _& T0 h7 ~
- str := callLibrary(j,"resetStr",str);
% Y+ D$ n, ~' W/ W - promptmessage(str);
# N3 g$ Y7 l, a0 t& s -
3 n, E! m h% T9 N3 t - callLibrary(j, "listAccess", Tablefile);: h0 f9 b, l) o0 e# U9 h: [
-
" m, g4 W- Z6 E* t4 D i5 ^) s - print "Unloading: ", freeLibrary(j);8 r* n, T: h5 x( W0 ^: _2 J
- end;
1 }/ n, g5 [" q" H! S0 C S - end;
* _7 c1 V, i/ |2 y% \+ t7 A- t
复制代码 |