- is
i& A; k8 h! y4 m; O - r:real; file:string;
$ {' B1 r7 T ?2 T - do
, M$ B! @4 S5 h0 E# E3 P - openConsole;# b. h2 J) Z" w1 W+ k
( M* z4 y$ {! K* w- /*# r/ L" ]! g7 @/ }
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
/ X- M0 c: i$ q- B, b3 i - when is64BitApplication then 64 else 32,
1 v( [4 r1 S! \ - "bit.dll");" c5 ~% I9 l" U% D" F6 d; R/ X
- */
3 \0 s) E3 u9 Q- W& q: H ~5 ] - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";9 X9 Q+ o3 D# t y7 k
- local j := loadLibrary(file);
; b2 p3 ^ O5 ~1 m
4 c& Y$ o; i# M7 Y- if j > 0 then
% E+ \8 K; Y' o( W5 }3 C0 o. @ - print getLoadedLibrary(j)," is loaded.";) `. M8 p: W8 G1 n z
- 7 [/ i8 N& {7 b: p' o2 m
- r := callLibrary(j, "calcSin", PI/6);6 Y9 S, G9 M+ y$ Z% Y" G B% _
- promptmessage(to_str("sin(PI/6) = ", r));+ m4 q) Z) P0 p- m" p
- & u. p9 L+ O2 c6 T
- local str:string;
# r. |; ]: D z! o: q - str := "I'm OK!";- n' k0 { S/ Y [3 x3 |, B- e
- str := callLibrary(j,"resetStr",str);
$ S: h" @! [7 L - promptmessage(str);1 J) L: `% q! A! _8 W
- . {1 S% M- l1 U! z
- callLibrary(j, "listAccess", Tablefile);
! a6 P0 Q" O: q. q j - 5 l6 c$ d5 Q( y1 S& V+ G' F
- print "Unloading: ", freeLibrary(j);
: N: c" Y# J( k7 f7 R - end;
: V7 H% Y L$ }; R - end;
. u) o6 E* i: d8 b& q# Y( Z# f; A
复制代码 |