- is8 T; H5 ^( l$ U+ N
- r:real; file:string;+ V7 j8 d0 O& h$ J/ e
- do+ @/ i2 c% \% Q5 y/ a* e3 y
- openConsole;
) U! h" T8 y$ R( U
& }; V! i$ J- i* i- /*+ s Q( ?6 ]; c( b8 `+ ?' @9 _! ?
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
( u6 z6 R0 c; G$ |! g2 n - when is64BitApplication then 64 else 32,
4 k* d! a! _: x4 q! s - "bit.dll");" n. J9 m7 K5 t
- */* J5 ~/ q" d8 s n: P4 W
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
/ @# t' ]% r3 D F5 u( ]$ i1 ? - local j := loadLibrary(file);5 i/ t: b5 P; M$ n# N) \
- . s: T* u4 e" w0 p
- if j > 0 then
* u4 }2 Q3 t5 e6 `: o7 x. I - print getLoadedLibrary(j)," is loaded.";9 s3 R7 U+ n' O7 t
- # F; `) w; U9 J2 y+ F! I& w: m/ z
- r := callLibrary(j, "calcSin", PI/6);' B: m& ~# q0 P% e- X9 v: m/ x
- promptmessage(to_str("sin(PI/6) = ", r));' ]: Y2 m& q$ a
-
3 i; }* ~% {7 c$ { - local str:string;' U; G( [4 G& W8 U7 F$ X
- str := "I'm OK!";/ E" n" _5 B; D
- str := callLibrary(j,"resetStr",str);
9 x3 J+ N1 b) j) \4 D - promptmessage(str);
* _6 J5 e! t. ]. X" M& {9 R -
) u! ]( T. T8 F8 e3 i - callLibrary(j, "listAccess", Tablefile);
8 E8 i8 n% l9 O7 V5 G5 B9 r5 B - & m0 x" s& a! P8 I
- print "Unloading: ", freeLibrary(j);) O& Z9 _7 T9 A
- end;$ _; t4 Y Y) g- ~5 B% O1 O' M) X
- end;
0 ^; I# C+ R4 t' G) g
复制代码 |