- is2 `( j& G# d$ J; p- h
- r:real; file:string;; X/ S( O7 {" c. I5 I S/ }# e
- do
7 o. K+ s7 v3 N' ^6 F `' W( T - openConsole;
0 p7 X: e& j! b9 O - 9 F6 e; o J5 u8 E1 X7 ~3 n
- /*4 k9 s" F1 |2 o1 U2 m. b% y& V, D
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",& I ~& E2 I+ s& o5 M: y* r# }
- when is64BitApplication then 64 else 32,# v0 v3 W5 [ u4 ~- U
- "bit.dll");& {. w e6 f1 t3 u4 ]1 ]5 h! I* s
- */# w; K Z% \8 \0 u. z2 L4 N
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";/ P/ q1 J8 ~0 ^& ?& z y
- local j := loadLibrary(file);7 n/ m/ W* u! p; `0 c
7 X/ u( j) Z( x* i) u8 \- if j > 0 then
4 A5 Y$ B- W" e8 y$ O& k/ s* U - print getLoadedLibrary(j)," is loaded.";
) r4 f8 X, e! |9 E% \5 l
7 S" b1 L& x r+ Y3 |- r := callLibrary(j, "calcSin", PI/6);
! l# h$ i$ |* w0 ?, ] - promptmessage(to_str("sin(PI/6) = ", r));
* d" v& k1 r2 R7 O Y | -
$ U7 P; u8 X |" a+ m! R4 M1 ` - local str:string;
6 l( u7 K+ j$ a. O; b' ^+ Z - str := "I'm OK!";1 c0 ]8 ]3 }% v, @6 J
- str := callLibrary(j,"resetStr",str);5 W% P; S8 J7 c, Y1 W
- promptmessage(str);
0 E: P- o/ [; d2 l7 q -
4 e k/ T) K# j9 E% K - callLibrary(j, "listAccess", Tablefile);) E: k9 q8 W! o+ M; l& l
-
% l) G6 r- y5 O9 R( V - print "Unloading: ", freeLibrary(j);
% A- |' c; {9 e+ o y - end;8 U6 j. r! _ g) N
- end;& k1 R' r/ a# s
复制代码 |