- is2 g( r* i8 G- g1 W6 `' U( e# g
- r:real; file:string;
$ X' Z4 T% a; y' y - do- l0 P' ~& \- x7 K; K
- openConsole;. c. e% Z+ p3 N
- : _7 F8 ~# m1 R" d6 E
- /*8 r2 t0 U3 y) f- l' ~4 \
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",9 A9 m& {: D1 D! ~! ]9 v
- when is64BitApplication then 64 else 32,$ S+ p" m% v* L4 Y
- "bit.dll");7 i3 j, h7 K R0 |% K2 j6 c
- *// ]5 e2 Y) Q! J9 @$ q' x
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
/ B2 ^: C ~ F7 |# D - local j := loadLibrary(file);
% u* B9 N& c; ^. B% \1 G
6 w9 t; W/ U+ J" T4 L) A: h- if j > 0 then
+ j" d" u! ~& _- b3 t4 q4 ^3 M/ v' r - print getLoadedLibrary(j)," is loaded.";) }/ s- R2 G# S8 B' E) Y5 h
, }3 F/ L$ U" |1 x: X5 s- r := callLibrary(j, "calcSin", PI/6);
: W t' b; t d+ V - promptmessage(to_str("sin(PI/6) = ", r));
) p! m h0 C0 d( v+ `6 B -
- Q; z: A+ T6 X - local str:string;* n% B/ d( B$ u1 l+ _+ e
- str := "I'm OK!";6 K5 a+ e5 K/ u; q$ L2 b
- str := callLibrary(j,"resetStr",str);
, r. ~7 U) \. ]& Q& s0 j3 `9 p - promptmessage(str);4 d& c& p& h7 G3 A C: |) T
- , V1 A2 \$ v( I) N. G1 T4 U
- callLibrary(j, "listAccess", Tablefile);
# x8 E# O0 e6 z) K2 c -
' v7 R* x- q" t n) I% J- L5 ?# g$ x - print "Unloading: ", freeLibrary(j);* T3 i# m- m2 Z" B
- end;- b1 Z4 B Q. _# p- p
- end;
* `9 \7 R( q; I+ y2 D: A4 V; j
复制代码 |