- is/ M' ^0 I4 `, K. J$ n
- r:real; file:string;
: a# S" v( X4 P# ^6 F - do
# K' N" y9 p/ G" ^& t. r - openConsole;
. p9 Z# ]3 i' Y& I% b/ s% r3 t1 @% j - : l% E$ I# J) n" K+ _
- /*/ q4 ^+ Q* j7 W& ^/ w, e; \
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
0 E( ], i1 J, P1 V' t% L/ u - when is64BitApplication then 64 else 32,* y6 C% ?# k1 I, o
- "bit.dll");
! c6 B3 B- z- V$ C0 E; f - */0 h; o5 N' P w4 B& l, I- Q% m# e' j
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
8 b5 U, i3 ?. B1 K - local j := loadLibrary(file);' k3 J+ Q9 E, \, v$ i% n2 Y
- 3 n- e) G0 _% G# _/ O
- if j > 0 then
7 V! U" ~+ w% A2 Z7 ~2 E& V - print getLoadedLibrary(j)," is loaded.";
. j% c( ^+ k9 h/ c - ; i" O5 ]( R1 A& Y% R' R9 k2 W2 s
- r := callLibrary(j, "calcSin", PI/6);/ i4 b' F4 i1 c
- promptmessage(to_str("sin(PI/6) = ", r));
: u" i. {7 f! G- J) q - ! B5 ^7 p9 O+ M$ O# j: U% D
- local str:string;
3 m3 ]$ v+ T- @( i2 X - str := "I'm OK!";
4 c1 s( E/ C7 A# Y8 U - str := callLibrary(j,"resetStr",str);8 q! [- G* W" ]% ~
- promptmessage(str);- I! w$ U. _$ o8 @+ o* O$ X
- 4 {. @" g+ ]. F
- callLibrary(j, "listAccess", Tablefile);* F1 L' C+ x2 H, X
-
" E9 p' F+ \8 B" {! ` - print "Unloading: ", freeLibrary(j);
! N- W! P1 V8 ]2 d& z - end;- R* c% J2 V4 D f
- end;
# v" j0 ~5 @0 k+ z* s" w
复制代码 |