- is
! i- t/ d* ]( I) X' B' f% Z - r:real; file:string;
) k7 M: z% E" b& W - do
% z, R( N! C: u: _0 |( `- D- [ - openConsole;2 D) a% F! A: R$ q; @5 y% U7 A j
, J# O% S$ u) d) H. F, d$ r- /*8 C6 K# M4 }* s$ [; ?
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
, g1 u, V( E6 Z& @ - when is64BitApplication then 64 else 32,
8 h" o& q# _0 R/ S - "bit.dll");
& l, p" S, `: l: B - */
$ H( V$ x" R. o( R1 z% n' Y9 j - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";- H _. ?1 S% t! }1 n
- local j := loadLibrary(file);- J% |( w9 c0 g/ u r
- V$ Q0 v/ ?; ^* a8 z, O
- if j > 0 then
1 J% }& S, c1 Z% t3 Z - print getLoadedLibrary(j)," is loaded.";
( N3 d4 D c3 m. @7 w/ W4 L - 5 l& |) [* U# e7 N5 U
- r := callLibrary(j, "calcSin", PI/6);! \& Q9 {( _$ D/ m6 |2 }( P# G" [3 j
- promptmessage(to_str("sin(PI/6) = ", r));
! Y' ]2 |4 {$ H6 H; z* ]; m: d6 C -
, t$ i( q. O/ F& F1 ?1 N1 Z% |6 X - local str:string;' {/ l; {0 F9 e3 m
- str := "I'm OK!";6 [' _: _1 g1 L' s) U4 Q- e/ v
- str := callLibrary(j,"resetStr",str);; ~ Z+ i0 t$ W) Q
- promptmessage(str);' k, O7 g/ D F5 K0 J0 U5 r
-
0 `: s0 k& A9 M$ N0 ] - callLibrary(j, "listAccess", Tablefile);4 X/ u5 }0 p o3 L# o- p
- ; i* ^ c1 \: { ]4 N* @- O
- print "Unloading: ", freeLibrary(j);- S6 K# ?- R. `, g
- end;
/ P% @' O, Z4 n8 p - end;2 W$ h' w# Q6 g `4 T' V' }
复制代码 |