- is
# h x' A& l5 e0 D - r:real; file:string;
4 M/ Z V. m- l7 D& X - do
$ A. _ W1 [& q" \# z/ ^! M - openConsole;) f: A0 F- R' _% z9 b Y' t2 c
- 2 U0 y; t2 S: K( r* Z% w ]& N
- /*# `9 ]) I: w, h$ m
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
5 W1 ~. S8 Y% \0 j - when is64BitApplication then 64 else 32,
% A* h9 _1 O8 E5 p - "bit.dll");
6 z4 b1 y1 T. T - */2 z8 C3 B# b" |" A9 q
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
% ]; J) i& G) ^* M! E - local j := loadLibrary(file);! M$ d( U( v$ R2 ^% V
3 E, t* {2 N" b, G0 y2 z' g9 n- if j > 0 then9 k9 Q4 s' D% g) ?% ~
- print getLoadedLibrary(j)," is loaded.";
6 s. p4 d B& C: V- M B
/ \9 m: k* s) e2 m. u. c! U- r := callLibrary(j, "calcSin", PI/6);( l6 Z: z0 d2 I0 U c
- promptmessage(to_str("sin(PI/6) = ", r));7 C- \* w M. }2 _/ }
-
( c2 T# i# h8 H( [ - local str:string;6 N+ l; ?6 S+ y1 @* X
- str := "I'm OK!";6 Q3 W2 T6 w' x* w% Z5 F
- str := callLibrary(j,"resetStr",str);
& r7 m* }+ G6 E6 J4 A# p! \ - promptmessage(str);3 z8 {/ P& s& q1 L6 y: f1 v
- 4 e4 p7 W* K; z
- callLibrary(j, "listAccess", Tablefile);
h% k1 H6 ]& f Y - 1 T: n: t( Z o6 C7 |9 E
- print "Unloading: ", freeLibrary(j);
- ~( J, d6 g3 ^. O) w - end;
3 l- r. U5 S# k+ R/ q - end;, K2 b; i/ [ J6 ~: |) m
复制代码 |