- is
% A0 O' h7 k* Q& A7 Y. o) G+ z - r:real; file:string;
* k' h. T3 B' X6 a0 Z& e - do. \" T' `, z# {8 x4 e3 x
- openConsole;
' C8 L8 r; ]- P" e7 a5 \
2 H3 h7 N5 X$ f [- /*+ k% v( ^* P9 @
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
. i- y! t& ~* u% w6 x" `# t4 a - when is64BitApplication then 64 else 32,
" W0 [ U, ]& A3 e - "bit.dll");& l) ]; s; i2 n) V% u; T
- */
: X5 E( [6 A& [2 q - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
0 m. o) S% L( P - local j := loadLibrary(file);
2 A* D; E y' G7 `4 C& }
V( N3 l$ n- A( b- if j > 0 then
+ T9 t1 l( W. p1 ? - print getLoadedLibrary(j)," is loaded.";+ `: W. `/ Q0 k6 Y# J) L4 N v
- ' m f. T1 c/ A6 V% ^/ b6 `
- r := callLibrary(j, "calcSin", PI/6); X( D( p3 V3 T
- promptmessage(to_str("sin(PI/6) = ", r));, \0 U4 Z0 T$ B- _2 k+ t% G4 [+ Q/ v
- 1 ~9 H8 R' q) s. L: D9 ?- k
- local str:string;0 Q) O" l) E' L2 y T- M, z
- str := "I'm OK!";
9 R7 M- ]; e) x5 D/ ^7 N - str := callLibrary(j,"resetStr",str);
9 \; _5 {3 O: e; v5 D D5 i - promptmessage(str);
, J. N2 m# b: K) Z, ~! }% w - ( ^# G9 p% A* Z& } L0 F# @
- callLibrary(j, "listAccess", Tablefile);+ N" E2 ~) b+ w l$ h0 A
- - Q! O$ K2 {9 H, x5 B
- print "Unloading: ", freeLibrary(j);
3 C2 O1 j4 @) ?6 G) a - end;
& H7 R& @( Z* ]3 F7 a4 b& z - end;
* J. Y0 L) J" i, L! I, T- k; s! Y
复制代码 |