- is
. p% Z" {$ `0 H k: g9 b) W+ r - r:real; file:string;+ a' B/ J( a3 ^, l* O5 r
- do
7 {. g2 D; Z W8 r" a; {, \ - openConsole;6 X: D7 M+ D) @4 F$ ~% x" x
1 |, R o+ R1 d1 c- /*% X. ~5 m( f5 }3 M& F m
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",! [( ]" g2 _ y Q7 f1 A, X% A/ F
- when is64BitApplication then 64 else 32," v- t! g, ]1 w0 c3 t, d
- "bit.dll");
C( k9 h# | D1 F& f" N/ P - */7 N! o' l8 E$ ~2 _
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
3 D; N' r% x" f - local j := loadLibrary(file);& u: A3 |$ \0 m: O+ T
: T$ d# ~: A- ^5 d- if j > 0 then
. [5 o+ R$ @4 H5 d - print getLoadedLibrary(j)," is loaded.";6 U0 C! k) O6 M# k- b& h
- 3 H/ O# g# f7 ~3 R! ]
- r := callLibrary(j, "calcSin", PI/6);/ D. M/ |& F7 l+ R$ m7 Q3 ~
- promptmessage(to_str("sin(PI/6) = ", r));
* ]8 u2 v/ Q, ~$ K6 ^ -
( |7 w9 O# }. D2 l7 { - local str:string;: f g; ^/ i, S8 a; O+ \$ C
- str := "I'm OK!";) D6 {& G1 \6 s% k5 J- f
- str := callLibrary(j,"resetStr",str);, j. K! ?+ C' U0 @ t
- promptmessage(str);
0 Z, d! u) \% X0 s- X, [ -
' [' c' t- j4 _( m7 x - callLibrary(j, "listAccess", Tablefile);
& o2 i9 P: M5 X -
6 q* Q# x9 i6 |6 @9 T - print "Unloading: ", freeLibrary(j);' B8 k- E1 T' v2 h) d. O
- end;# O/ U3 o! w' x/ [; N. {4 s6 h6 c
- end;
( c) x3 V, U) t+ x3 B6 D2 ^
复制代码 |