- is
, T8 w [# g# y+ K W/ [% @ - r:real; file:string;
" b! K3 E& i' D) t0 o1 s9 @ - do* c* ?: L. _1 j: u, q
- openConsole;
8 [: D: K2 \; h7 e
: j* W5 ^5 ^( P; A* }$ ~$ A. i7 r- /*
5 d& C# q% m( b. E - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
& |4 g1 P9 y/ i7 ]. _, J - when is64BitApplication then 64 else 32,2 j, s: z* v3 i$ R
- "bit.dll");1 Y/ A) \* U$ p& A
- */9 f- O: q9 D" \
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
0 i* j5 n e7 ~ - local j := loadLibrary(file);
* Z0 P$ s# E* t. Y; _8 D1 z
4 y$ T! V, c8 V9 J8 t- if j > 0 then
; D* e7 v; r0 `( s' {( T+ |/ ^ - print getLoadedLibrary(j)," is loaded.";
1 D! J9 X; R2 } R% ?
$ b- m Z9 s( \- r := callLibrary(j, "calcSin", PI/6);) v0 u) R" G. X2 X8 H
- promptmessage(to_str("sin(PI/6) = ", r));+ S* P; C" m1 _- [% i. I& S* \/ p
-
, Y& F2 O5 J1 s' b8 y - local str:string;* h" S/ U* w# D: b" n1 a; |/ Z
- str := "I'm OK!";: S$ j6 Q" @; q E: g
- str := callLibrary(j,"resetStr",str);
% r0 h0 X4 ~7 a8 ]* V! p1 z - promptmessage(str);
. v5 }) D6 h! K# d1 X -
& n) f7 J! R6 s# A - callLibrary(j, "listAccess", Tablefile);
* e+ h5 L0 V3 z3 w% \& }( i - , G# B3 p, ?( h% P9 U
- print "Unloading: ", freeLibrary(j);
: a& \/ F/ l5 @: R8 i& q, w: ` - end;
; A: e. z1 h1 m, B6 Y1 v - end;
3 G# J$ \; D2 R+ l3 f& c$ N
复制代码 |