- is7 @& v0 [4 a- T1 ]
- r:real; file:string;7 a1 d/ f9 V' Z+ }. [
- do6 e" t! O7 K5 j. ?5 l0 U
- openConsole;
) ]" x+ W# y* Q$ @8 Z+ n2 m5 i - # ~% H4 N- D% P& s; \4 r
- /* T6 `: S! Q; Z9 h1 Z2 N! n
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",. ]! @' v/ [3 n! B3 s+ P" D$ q
- when is64BitApplication then 64 else 32,
. b; j7 l% q) l - "bit.dll");
; F" M( [9 ~0 d# [ S - */" G x& u' M8 L0 r
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
8 a+ w7 [/ k2 F9 m - local j := loadLibrary(file);3 O3 }% [/ ^9 h# d" [/ N6 A' M0 P
2 ~& M* R% O6 x4 r/ l4 N4 J. V6 S- if j > 0 then. p4 `" i1 d% V4 J2 O) K/ e
- print getLoadedLibrary(j)," is loaded.";
9 I& [- a# W& m" K, k
1 @# D: r- r6 N& }) p# G: E- r := callLibrary(j, "calcSin", PI/6);
- v0 P d' e8 F0 }8 R - promptmessage(to_str("sin(PI/6) = ", r));
! d" ^3 Q+ f, x, L& v0 x - , f* `: [( `# i- Y8 c8 Z9 S" {
- local str:string;
! t& j2 }& d" r% D& I$ u - str := "I'm OK!";/ Y8 A1 b% \, ?2 p& ]
- str := callLibrary(j,"resetStr",str);
, C' W5 m3 l" q - promptmessage(str);+ u" ~9 X* ? y( ]4 w
-
# o3 c( x* T& n$ H - callLibrary(j, "listAccess", Tablefile);
" [% b. Y( V9 V1 M7 d -
' i4 c+ H, o) s# p1 y - print "Unloading: ", freeLibrary(j);4 E' p2 A$ a8 S, ^8 H$ a
- end;
, C/ P5 V' C( U3 C2 X7 P8 O - end;
7 s" A" y% @0 _/ ?# O
复制代码 |