- is( m0 v# i' p6 L* J8 V4 p P; P
- r:real; file:string;( B- B# W% z0 x4 g- M6 Y
- do. u0 a5 j; f7 w; ^
- openConsole;5 I+ I( X p4 }
- 4 b! p5 e$ X$ \# c% E
- /*
9 J) t ~& x6 k - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",- [3 Z9 t$ x% Y! z9 V' G9 g/ R; r5 L
- when is64BitApplication then 64 else 32,
3 y- }8 ^1 S, C& z3 `9 M6 H - "bit.dll");0 ~7 B! T! r. H
- */* R- V( ^4 V% l
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";4 v+ p3 k; Z. O( B
- local j := loadLibrary(file);
. k' y1 j" m: O - . [ U) h7 u5 i- Q' p1 M
- if j > 0 then
}5 j- s$ g9 a+ [+ p - print getLoadedLibrary(j)," is loaded.";0 Q" a( t% _* y' v6 c6 J6 N' c: {
" _. a$ s# t* i1 \& y0 A0 X- r := callLibrary(j, "calcSin", PI/6);
2 R7 u) e, X+ U; ^9 b4 e - promptmessage(to_str("sin(PI/6) = ", r));
9 ]. ^+ t3 B* x9 ]* v -
& u d& X* L6 G2 e$ P+ s n" T0 [, t: M - local str:string;
+ V/ h& C% B: u. ` - str := "I'm OK!";3 f5 ?: i1 O% l) y' r5 z
- str := callLibrary(j,"resetStr",str);
7 K* c; I6 A$ k6 O9 [ - promptmessage(str);
b, Y2 e& l8 G$ s. v5 | - ( G- t$ e( M! e2 u: L* [) d
- callLibrary(j, "listAccess", Tablefile);3 S) x& f0 v. V# d+ a' }8 F: {& {- H, G3 b
- : v {; F6 g' ^7 P- T
- print "Unloading: ", freeLibrary(j);& `- R: _1 [1 M g% g
- end;- h+ e* b+ H+ P9 C; M, K9 N
- end;
+ E0 I2 @: Y6 T* t( a* u5 U9 N2 V
复制代码 |