- is
2 ~/ \" F! [0 c; i - r:real; file:string;
4 O1 l* i3 H9 x- t - do
8 n' }$ k6 L; h3 _- E f - openConsole;8 @7 I& y0 b) y0 q% u! u
8 n4 Y: h+ W% v) E4 N4 @- /*3 |+ t" j- b" a' H9 x
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
5 }1 T" G% k9 E: \" u2 n ^ - when is64BitApplication then 64 else 32,
( L, `1 T4 [' s _# |, C - "bit.dll");! |( M$ R5 j3 V r, x; j' w, P' D
- */
* e( o8 N7 { `0 s: Y) ] - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
# u3 j, j3 Y1 L& ~% S ` - local j := loadLibrary(file);: e& i6 l1 ^) b4 U# X
- # O, K0 K! m5 p9 u) |& X; Y6 `
- if j > 0 then* O# p& \% H7 r
- print getLoadedLibrary(j)," is loaded.";" R: G" X: H! Z( J2 i
8 Q, W; m: ?4 s; d. a9 @6 u- r := callLibrary(j, "calcSin", PI/6);
5 i/ G' K! [& g2 C - promptmessage(to_str("sin(PI/6) = ", r));, m3 ~- q8 i6 W0 C/ ]8 q# p2 e
- 0 P8 W. ?$ Z9 g8 l9 Z, _* M& N
- local str:string;7 {+ e* ^9 s( A0 ?3 W& u* C
- str := "I'm OK!";7 d4 A9 U6 U) P2 M
- str := callLibrary(j,"resetStr",str);
; G' W& ~ Z# i7 p9 X5 d, h - promptmessage(str);
- p! j* w. i- u; S. f7 q1 _) T; n( R -
1 r! G4 j- `# ]' e; L- N& m" L: ? - callLibrary(j, "listAccess", Tablefile);% J6 S) r: d. ^4 t
-
0 o! X4 x4 }& s4 Z: @( U2 ]6 U' N3 X - print "Unloading: ", freeLibrary(j);
: B6 n1 J' R) D4 E - end;, r' K* \$ g; p% l
- end;1 e6 o9 l% e& f
复制代码 |