- is7 f% D8 F3 p# X+ g0 x
- r:real; file:string;' b, G/ u% p- ?; ~" I& X
- do% ^ }" {4 }% i% O5 Q
- openConsole;- l, b( Q1 p" v( t$ C7 k O
- ]$ T: w0 g( f2 M x
- /*
) |6 U) Y0 u1 W; Z4 v - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
9 N# e, N3 X' h) w( Z/ _/ c3 o: e - when is64BitApplication then 64 else 32,+ |7 h+ i4 f3 R0 M
- "bit.dll");
- J/ B0 }* l# ^/ _1 w. H2 y, G - */
6 P( @6 ~3 N2 a! f - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";: D/ J% L9 ~8 `5 A3 G$ g* G
- local j := loadLibrary(file);
3 i! N- T S# B' n: B( W+ W) P: |, P - ; p0 v5 m0 a4 Q7 T o, C2 B
- if j > 0 then- D: j q* H5 W# j( e. x- w
- print getLoadedLibrary(j)," is loaded.";
# F; v; [! T7 x2 F+ X6 I6 t* G - ; v! a9 n; f! `- c, Q
- r := callLibrary(j, "calcSin", PI/6);; O& o6 u$ W+ S* x: J: h8 d/ X! R7 P
- promptmessage(to_str("sin(PI/6) = ", r));
# p* `! `% I% u( f& t/ V -
4 i# I: f0 g. \! v; V - local str:string;5 T+ U: C. _* H; W, Y6 c* Q
- str := "I'm OK!";# W5 x) H7 x$ w1 F
- str := callLibrary(j,"resetStr",str);6 t. N; ^" G+ w# y( v }% H1 i
- promptmessage(str);
( y9 e& Y7 m2 A% G4 s - , \# Y+ O* q; D9 a, m( p* A: t
- callLibrary(j, "listAccess", Tablefile);+ V1 l( e( Q! i) W
-
5 W- l; {$ G( y; f- a - print "Unloading: ", freeLibrary(j);8 d1 Y( d( ?( c
- end;
' A1 V. U) Q! U2 Q% G( A. ^& Z/ i- g7 P - end;" q6 h/ d! `2 L: F
复制代码 |