- is
4 ~) @7 l4 M' |6 x+ R% s - r:real; file:string;
8 n% s5 P$ M0 {) O' _, F - do
2 Y7 A. I/ C; R/ P: {8 M y - openConsole;
8 M* a' ^3 L! T) r1 Z" S/ a
" M6 x/ N. R9 G) f" `* \1 q- /*
* c. }, f7 W0 W$ D- [% S - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",/ a/ i" t. s, B/ W% v/ @
- when is64BitApplication then 64 else 32,% [2 Q) l: E) b% [# w1 s
- "bit.dll");
6 [! H. u( L8 G7 s. n* b8 B - */
" D# c7 S ]; c - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
1 i6 ?8 @, A' t6 x - local j := loadLibrary(file);
5 S9 S" N- M4 {+ m- {
% C0 J) q1 N4 I7 W% q' Q' L- if j > 0 then
, d0 a; L6 e) j4 @ - print getLoadedLibrary(j)," is loaded.";
) x; ~& T8 B3 h* l' K; { - " k) |) s8 T3 r- }9 b
- r := callLibrary(j, "calcSin", PI/6);: g K, E# @0 M9 R' k
- promptmessage(to_str("sin(PI/6) = ", r)); c0 m4 E5 x; K( W/ v d
- 6 T' [9 r% z) S8 c: i( a
- local str:string;
6 N5 q) Y% S; B - str := "I'm OK!";
9 B% n7 F% k! v, d: R$ H- O - str := callLibrary(j,"resetStr",str);4 L4 y1 V+ O4 Y9 F
- promptmessage(str);- l& M* ^' s* u9 b1 o6 X
-
9 o. V# t0 z! q: z. C: U# B) V# u - callLibrary(j, "listAccess", Tablefile);
9 ~6 g1 F* T, o - 9 A$ Z/ u4 u' o- D: u% E# Y
- print "Unloading: ", freeLibrary(j);; t( ?3 B$ Z( P+ {7 H0 T2 Z
- end;) z, Z+ v' c3 t% T1 e1 ?" K
- end;
) z0 `( [0 d, z5 Y1 N' F
复制代码 |