- is8 Q) P& Y- d2 q/ m* b1 a) r
- r:real; file:string;
& e" M* W1 Z. A - do; `5 C- U) m! i; ~, s; D( p4 d. U" g
- openConsole;
4 |# @8 ^. Y/ O5 N* ]8 P
2 p7 }0 i% Q+ J, g+ r% c; Q9 f- /*
* E+ B; F: z4 l- K" o8 ?$ | - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
- v/ i7 C% M: u3 e' s4 T - when is64BitApplication then 64 else 32,
& D5 {: s# P4 p1 P9 G- K4 e1 d; {9 \3 h - "bit.dll");" H, u5 S/ d3 |) J* C' ]4 m/ [
- */
4 m. r3 M! M3 D) c2 f' Q - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
6 M5 g- n: A& P- h. y' U; \ - local j := loadLibrary(file);
, u6 y4 V0 O3 U& H+ k. X$ g
! }7 {4 J+ X* }% m7 H- if j > 0 then; e5 y4 }# D3 b5 }8 i: ]
- print getLoadedLibrary(j)," is loaded.";9 A: {+ z1 ^$ ^' l
1 o. q, b( Q6 N! R- r := callLibrary(j, "calcSin", PI/6);7 J2 n0 f6 y7 h5 A
- promptmessage(to_str("sin(PI/6) = ", r));5 j& n" x0 l; Z' M R
- # r3 X5 b8 D4 W: O
- local str:string;5 | H- c+ k6 V# f& \
- str := "I'm OK!";" `3 W2 r3 | Z1 j, r
- str := callLibrary(j,"resetStr",str);
4 K% [" C* f8 k) s - promptmessage(str);, p7 J+ a% Q( c- a, I& x3 {* @
-
* j; \1 y' ~5 @4 y2 [3 \# _ - callLibrary(j, "listAccess", Tablefile);) R7 l/ m C1 {8 y v5 b$ ?
-
& z3 b3 `& R; A - print "Unloading: ", freeLibrary(j);
9 c+ f: M2 U: ?) q7 s9 e - end;
. I5 T0 j$ w; Z6 i1 C5 s/ b5 Z - end;
& N; T. [+ S$ E3 ]- l' L# Y
复制代码 |