- is
# Q* r8 f h+ W' L - r:real; file:string;
; |) l4 }+ o& L1 i - do: ?6 }9 ]6 z7 C: ?( v
- openConsole;
/ p! L; ^- q* Q+ [5 K
7 g- q5 M1 ~; R/ r: G ~- /*. I# G- h! L- E& s
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
) m1 X) w5 d) i, q j' m/ O3 ] - when is64BitApplication then 64 else 32,
W0 |4 I" j* \! y9 ]; y1 E2 R - "bit.dll");4 l6 D7 |# A5 Q2 f
- */1 g" t3 G/ {1 [ ^ d" p
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
6 m' K8 q* R# Q" k - local j := loadLibrary(file);
2 _# J6 p7 i0 N1 X$ W( d9 j
9 T9 b' ?. J0 X5 P) L: A1 t6 J% ?- if j > 0 then
3 a- B( \" n( G! P8 F2 B7 g N& c - print getLoadedLibrary(j)," is loaded.";; b: G) o( u6 u4 E; w
- 6 ~' @& L7 N# r3 P4 _8 h. o7 i8 b3 a. Q
- r := callLibrary(j, "calcSin", PI/6);% d" [% F: c2 n8 m& f7 j2 m
- promptmessage(to_str("sin(PI/6) = ", r));" Q5 K; d! [; ] x% E3 \' K
- 2 ^) C7 q6 o# M! w: A
- local str:string;2 q. N1 i H' |
- str := "I'm OK!";2 |9 s9 I7 U4 V! ^
- str := callLibrary(j,"resetStr",str);& g' X; F5 u0 r3 V4 a% T
- promptmessage(str);- L2 x* _, `/ I( x( Y
- 3 ^9 C% @* b2 m& W! Q8 S7 R: y
- callLibrary(j, "listAccess", Tablefile);6 Z$ a. `, ~# o( `! w. v0 u9 G
- 1 w, E- L8 N5 a, o# n5 G
- print "Unloading: ", freeLibrary(j);
9 n# U6 m$ Q2 s+ x( w - end;; x: r1 O1 q5 r+ c4 k9 Q
- end;% |0 m# n3 n/ d0 |( r
复制代码 |