- is, S) B; `6 @7 T# j9 V
- r:real; file:string;5 L* I ~3 |# [5 B$ M% Q# L7 s
- do
2 O9 f4 t+ s w/ G6 E - openConsole;
4 V; G3 X7 F r& {+ @
9 f( b' L2 T \ J* }9 V- /*( W5 i' p. F- N( o3 p
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",; z7 o2 a2 q+ m# E
- when is64BitApplication then 64 else 32,0 E. x0 x) a# _0 q$ c( @, o R& @. q
- "bit.dll");# t# ]3 \+ S( k" O) H* ~$ c8 Z
- */
# N0 X! x/ m& G& f - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
& r3 g5 U4 t j: K! A! X - local j := loadLibrary(file);2 f9 {2 A! I5 _* M
9 V7 y3 S" o( R* Q6 z% o- if j > 0 then
. ~1 S% c) s" z$ L9 z - print getLoadedLibrary(j)," is loaded.";8 y) Y9 [3 c- D
- 8 e+ j5 Y2 r; W' K9 x
- r := callLibrary(j, "calcSin", PI/6);
6 d* Q. x: `7 l! i' \ - promptmessage(to_str("sin(PI/6) = ", r));% a9 \ C6 F& _
-
/ ]) W8 A& V$ \, y- R* ^5 ~ - local str:string;
$ ^+ h" y0 D$ [7 H H: H - str := "I'm OK!";: m+ X; e; p3 U
- str := callLibrary(j,"resetStr",str);
- x7 `/ }% d2 z4 R - promptmessage(str);
5 l7 A# y9 z) Q( W8 ~" ^( o5 n - " }, p& d- \' d4 y( W
- callLibrary(j, "listAccess", Tablefile);5 a4 u. o7 a9 F( v
-
. W" O! i# L9 L l/ e - print "Unloading: ", freeLibrary(j);( S. J1 l0 |* W, G
- end;
, x7 ~, b( B, w1 h - end;
t5 _' Q8 ~- c2 h- [2 O
复制代码 |