- is$ b ^, _4 M6 t9 e( I2 X K0 ~
- r:real; file:string;
. P0 L* z, f1 q% e5 W' C - do' x8 A5 D# i' a$ ]( B
- openConsole;4 m8 n0 M4 }% w2 ]9 q2 J
- ( y f3 Z2 c& _% ?( [& y7 Z
- /*- e* D% Z3 m# @% a2 `3 E( S
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
/ \% V& r) z* v$ U& A2 G# o% y+ T" I$ [ - when is64BitApplication then 64 else 32,, a M7 F$ A6 ]- ?. l
- "bit.dll");
$ w1 ]& s/ k9 X. a# Y2 ?2 i - */
7 [" g, G8 }; P' L - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
: L+ M5 a, e3 a" k4 n - local j := loadLibrary(file);: p7 d# M, t+ t; A
- ! I5 m3 s2 d1 {1 s0 c3 u9 T
- if j > 0 then
1 |4 e, N+ t8 e+ x' x - print getLoadedLibrary(j)," is loaded.";6 ^) G/ q7 a+ d0 B5 J1 O
- 3 h9 f) D8 R. }8 n& w
- r := callLibrary(j, "calcSin", PI/6);
$ T) d5 ~4 Q6 F# ?0 U i - promptmessage(to_str("sin(PI/6) = ", r)); O+ |2 ~: z g7 e1 }/ n+ a
- . r4 G+ W* W8 R$ O6 d! V, W0 [& ?! i/ k
- local str:string;2 ~5 n+ y; X6 `0 x5 d
- str := "I'm OK!";; w7 b% m- h( R3 {* f! K
- str := callLibrary(j,"resetStr",str);9 |& s+ x' L0 J5 b; t6 I, ^
- promptmessage(str);
! ^- m! S" i2 C -
7 ]' \! k! |8 d- C& l - callLibrary(j, "listAccess", Tablefile);
5 I0 m$ p$ @$ C2 T9 h - / F$ h7 h* n7 h, {7 v
- print "Unloading: ", freeLibrary(j);
6 f2 j. C6 }' j' q6 j( q' J; f - end;9 H9 w, d8 }2 Z: a* w Z4 H4 h
- end;+ m9 ^0 a# Q$ g8 e. N! k' X( [
复制代码 |