- is
: N# T! Y# T# h9 _- q - r:real; file:string;/ K# |4 [2 L3 j; W( l% Q: i
- do' \; S: j, A2 b2 k
- openConsole;
* g" B8 \' s) A - ; o- S6 @. j( ?7 l& e( [. I% @9 o
- /*
( h1 l' V3 V% C1 {8 j8 ~6 A( R - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
+ Z& S' [! [/ C) ` - when is64BitApplication then 64 else 32,
* `3 L9 m/ r6 ^1 a - "bit.dll");' S3 b+ D7 Y9 m6 R T: Q' g
- */' T# A# k( a, r3 M
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
, B% l1 l9 _6 P+ T9 |% G - local j := loadLibrary(file);
4 D7 ^6 n0 Z6 _6 v$ M! j6 Q5 e - & W3 D! B# }6 a3 K- c% T& O
- if j > 0 then$ _/ j4 D7 ^- c6 i1 q5 K8 t
- print getLoadedLibrary(j)," is loaded.";
) D1 E: w4 R! h6 W3 l+ Y" y - % R% U3 L3 h: L1 q* X( J( q
- r := callLibrary(j, "calcSin", PI/6);) n0 N* d1 r; D( C
- promptmessage(to_str("sin(PI/6) = ", r));0 X+ T! a! n4 }
-
( a) B" m. B! K1 s - local str:string;
- J6 u* ?5 _ @; c4 Y8 c - str := "I'm OK!";
8 _* c7 d$ G2 X - str := callLibrary(j,"resetStr",str);
7 E- n+ T% Q3 G- N+ x o - promptmessage(str);
6 `8 @) V0 s1 E' Z) v -
; B; t; o! ]6 S( [# F# A - callLibrary(j, "listAccess", Tablefile);, S: u% V6 ^4 O1 b1 U2 _; }7 S
- 2 I, x! a" `# Y8 m
- print "Unloading: ", freeLibrary(j);
+ e2 g! K- Q5 b% k# H6 F, E - end;
9 z t+ N! H8 o2 q, _ - end;
/ \' d. y, `9 `" [
复制代码 |