- is1 Z. k5 \" R6 w4 H
- r:real; file:string;/ k& e {: o: t. Q! F+ W/ A
- do
2 J) v+ B+ x* i {* Q3 F - openConsole;4 k2 @, w6 {/ Y w5 J. y# @. L! G
5 N6 u( m( @. C. ~; R# W- /*
1 M* n8 `& u; C% F, M4 O - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
3 j0 M& |4 N4 u) v8 P5 G" [7 ? - when is64BitApplication then 64 else 32,
; I a6 v6 F4 d( d6 B- W - "bit.dll");
$ m9 j- O8 p4 u4 Y% Y - */
& Z4 N2 B2 f+ q - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
" v# Z" S, ~' g- v - local j := loadLibrary(file);+ Z' }; C! X* X$ k
- 1 _% d# p' u- g2 l. e" U
- if j > 0 then$ v' D' c2 c# o
- print getLoadedLibrary(j)," is loaded.";+ _& D6 y! @4 {+ S a3 x _
7 x3 B& H5 F2 R) O9 h( m) u- r := callLibrary(j, "calcSin", PI/6);
. x) P1 {# x+ `$ K - promptmessage(to_str("sin(PI/6) = ", r));
3 g: h2 _. g. K& |- y! [" K S -
/ e8 X2 I$ N/ ?% I ] - local str:string;/ S, n6 H1 [. J0 Y6 p
- str := "I'm OK!";' G) n0 R& J s+ s* r
- str := callLibrary(j,"resetStr",str);
& E( _, P+ [4 {- V, _; W) @ - promptmessage(str);
* p, ]+ g! x7 h- ^1 `% p4 ]0 o -
; d0 ~) n3 A- V0 |( F" \- \ - callLibrary(j, "listAccess", Tablefile); T* R1 Q+ L. w6 _8 D1 M% _
- & _) E& T: n' g% i& A
- print "Unloading: ", freeLibrary(j);; @. g. R5 t' Q" T: b
- end;+ l. y$ w+ G* D& }4 k
- end; U4 X" X+ P) x! N* Z& }/ {
复制代码 |