- is
B+ q* ?* ?9 \8 U5 ~0 N4 } - r:real; file:string;
% d- o/ i; Q' _* K4 k5 S' w - do; O# x1 T4 \- u0 K1 G' |/ R9 l4 t
- openConsole;
/ f8 y8 r* a# O( g. [6 H8 K4 }
! \ A! a0 W5 ?7 E$ q- /*: y8 ^! g, B( p5 {! i" t
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf", T9 u$ @9 f- v6 I8 B# H+ |! D, a# B. Y
- when is64BitApplication then 64 else 32,
7 o6 x |$ c. m - "bit.dll");
/ j" Z) v+ P8 ^: P - */7 R# }3 n' P& m& A& |5 o! d4 Y9 u
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
) i q8 ~1 Z' }9 ?0 R - local j := loadLibrary(file);
, E, ^' D, Y3 h# L& k
1 w j: [1 j1 s# t% a- if j > 0 then
2 `. i' R; `5 o6 V - print getLoadedLibrary(j)," is loaded.";0 |- w; e, [" ]: A k: e6 h
- # P, z2 O8 T: ^ x5 h
- r := callLibrary(j, "calcSin", PI/6);- K. F; N; _0 c, E' f; y1 X" w
- promptmessage(to_str("sin(PI/6) = ", r));% Q: h/ n$ f1 X- u% Q9 G2 ]
-
" t4 a0 O* n& L6 j& ? - local str:string;3 T3 |5 k2 L+ J! T& N
- str := "I'm OK!"; R2 C) k4 j' J
- str := callLibrary(j,"resetStr",str);
( F! l3 j7 T3 K! O9 b: L - promptmessage(str);
& A: _7 k( E, D9 s% H -
) y7 E, }3 n* S7 k# {+ G/ H6 V - callLibrary(j, "listAccess", Tablefile);' \+ J: \) i& t& i. t4 O( h. ?
- & I7 u+ J9 `: J( ~
- print "Unloading: ", freeLibrary(j);
' I8 @" ~ |* b+ c9 O" ~2 k4 Q$ K - end;
2 V- x! o3 c4 \+ r1 J% Y - end;
7 H4 `8 R0 X( z& k& z R) p# B
复制代码 |