- is
; f+ t2 S& w3 T - r:real; file:string;
( y( D; u1 o; D$ Q) c* {, k - do
) _' ~6 w) Q. M* X - openConsole;
8 ?4 C. K6 K+ |9 P. N& n! y
, ^0 L4 r6 Y9 P- /*( Q: n% X3 e6 P! H& p" c( p
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",& C2 a2 e3 S" O; ]
- when is64BitApplication then 64 else 32,
1 c& I4 w. D: \8 |2 ?) H - "bit.dll");* ~9 g, r$ [( v( c% R, e& C
- */! b# Z, ?& k' H. Y4 ~' L
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
* J: l2 Q; v L9 V3 e+ r8 `2 ? - local j := loadLibrary(file);! a2 R, `. w, j7 E# g1 J
- " V. N; m; M, R0 q1 y& w1 h
- if j > 0 then
# u* r8 \% S- h. k0 o, r - print getLoadedLibrary(j)," is loaded.";
4 R% G5 V8 s& S0 G. W
0 P/ ~/ [; l# y f, F- r := callLibrary(j, "calcSin", PI/6);7 x9 N% n4 }1 S& R8 Q8 i: D+ K
- promptmessage(to_str("sin(PI/6) = ", r));. b+ a e5 k, _
-
2 V9 o( @! k$ U# W' R6 J - local str:string;
7 N Y7 l2 \1 x& Y1 c* f2 J - str := "I'm OK!";
! x& v D% [2 x0 V" I - str := callLibrary(j,"resetStr",str);3 i1 l7 p# X; L# d8 }
- promptmessage(str);
; Y- A7 e3 x/ ? -
: L. s; `- Q( N9 A2 ~3 P2 t0 ` - callLibrary(j, "listAccess", Tablefile);
3 }9 c% b: g8 M3 b& s! l -
' G# D% F# D/ }: [ - print "Unloading: ", freeLibrary(j);3 M( h3 K) O( ? T6 ] \
- end;% ~5 ^, `5 q6 d
- end;
4 T: K T$ }/ K$ Y2 [
复制代码 |