- is
+ `5 w: j2 l; d! y2 O0 ^' I& z - r:real; file:string;7 Q! m9 ~* L/ Y. t0 t, C: j
- do; y9 G1 K# q2 r( F8 w$ E1 k7 {& y
- openConsole;7 e+ Z+ V; Q; \ w: ^
3 w- `- b; |: H- /*
8 I2 k( t9 b2 H- N+ h7 ?& } - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
+ |( j% w4 {9 v0 T+ l - when is64BitApplication then 64 else 32,
8 J; W- Q/ }1 w9 ]$ ~; F3 ~ - "bit.dll");
0 c6 V2 |; S; k8 W - */7 W) _* Y& `6 g {! m: p7 G3 ^
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
/ e" g3 K5 J! m/ H0 x0 o" c - local j := loadLibrary(file);
, O' R* t$ L4 J$ r; v - / N, ^7 j* v! e% v
- if j > 0 then
, F0 \2 S! e' t( j9 d - print getLoadedLibrary(j)," is loaded.";6 o+ w0 i( J& D# A
% y( ~5 S! N0 Q s" Y' N3 p- r := callLibrary(j, "calcSin", PI/6);
( P0 N2 y3 t8 g6 _5 U6 X7 ^8 ?$ z - promptmessage(to_str("sin(PI/6) = ", r));; K0 s" d% J- n/ v( K
- 1 n4 u# W6 m, v3 |* Q$ j! X. b
- local str:string;# D$ V( [6 s( Q/ Y5 F
- str := "I'm OK!";9 i2 `/ U" R; T- e! Y
- str := callLibrary(j,"resetStr",str);* y) Y$ u0 R5 Y, W7 r0 |
- promptmessage(str);
1 i, k% N- t6 c; r - & ]2 D- S5 @- M1 V4 {( p
- callLibrary(j, "listAccess", Tablefile); _% G; Y8 H& h3 L/ R
- 6 @4 l: n5 E3 |+ r0 ?
- print "Unloading: ", freeLibrary(j);5 E7 |# Q9 f3 s: N" ]8 h
- end;
4 W- p" |6 b; p1 l4 f$ O - end;
) Y) k/ P d9 k( w! B
复制代码 |