- is
. r% `$ U/ m; O" x. c6 O; P7 P9 o - r:real; file:string;4 ?9 ^2 _- f; r& o
- do5 U. H% \# N: ?( [5 R- X; T; t' s
- openConsole;
% g& B" a F/ P( A
+ H; R/ G1 v* `' z- /*
7 n+ e4 l$ B7 C z: a8 p* L) g - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
. p- G! \% B9 }% |0 g: K - when is64BitApplication then 64 else 32,6 ^1 n ?- \& c+ _6 B+ t
- "bit.dll");
0 k3 p5 L0 @& o# } - */
0 w4 h1 `( b# L. U6 s - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
) f; p7 B& K$ V4 [% C) F6 B - local j := loadLibrary(file);, x9 C9 d, }! P: f" ~# F
- : x6 r; M) m" Z, D
- if j > 0 then; L8 |( c' U" f, C0 b6 p. M8 Z
- print getLoadedLibrary(j)," is loaded.";" P5 b; B/ B5 C. a
- ) c: ~/ `. k* r5 C
- r := callLibrary(j, "calcSin", PI/6);+ P9 n# \' f2 J+ d, C& l; v
- promptmessage(to_str("sin(PI/6) = ", r));; i1 O4 w; s/ ^6 m4 H+ _5 _, e
-
$ L4 y1 f( ]% u - local str:string;5 X% d* E2 T$ O# @: W& U
- str := "I'm OK!";$ _& [1 y# p3 p: I, ^ X3 O# K
- str := callLibrary(j,"resetStr",str);
( _* |- C) K7 S1 F - promptmessage(str);
: o, ]* E- @4 E/ f! [, z5 t/ s -
- r- ~7 b e! h - callLibrary(j, "listAccess", Tablefile);) B1 f, }2 B8 N
-
c; u+ G" i5 M0 V1 T9 i' k - print "Unloading: ", freeLibrary(j);
5 v( X5 H* `/ z - end;
6 M2 X4 N9 V* { - end;
/ x# q8 z5 a% ~/ }1 m2 N
复制代码 |