- is+ j. X% ]# p# @+ A
- r:real; file:string;
$ s9 `# ?8 C, n9 r2 B+ D! g$ [ - do
& E! N$ d8 O* P% \. W$ X - openConsole;
, L: T+ @7 }+ c4 t* B' A. |7 u - * V- E+ M* d8 m( j; R* u
- /*
1 X8 x) e$ I: c; z0 l' T - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
# R3 @" l+ @ [2 S) V - when is64BitApplication then 64 else 32,5 R. w9 B4 \1 Z: W3 g
- "bit.dll");: z! ^3 [$ a8 n. |& T+ h6 E" Q9 b
- */ b6 E* }- W2 C
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
1 J, _! V) C5 `9 b( O6 T0 j - local j := loadLibrary(file);, B( q5 [3 L: Q! w! J* B8 f. u. d
- " {' z/ k2 B$ o* j# k
- if j > 0 then
" O4 u( O8 J4 R0 c - print getLoadedLibrary(j)," is loaded.";
1 R; b5 u" D2 V8 V2 ~5 } - * Y4 ]3 G0 d9 p) c$ d
- r := callLibrary(j, "calcSin", PI/6);/ l) ^% c D$ Z* V5 A9 S1 q: Q
- promptmessage(to_str("sin(PI/6) = ", r));
- [+ g( W% v; ?& I0 {) ? -
& W% [$ n' E& E& a3 f2 p5 { - local str:string;; Q, l0 W. ~; _* `, |& Q
- str := "I'm OK!";
% \1 C" Q: y, { - str := callLibrary(j,"resetStr",str);
" [* C$ N6 e; \2 |( X7 u# \9 x - promptmessage(str);4 P& T9 v# K/ d8 L$ _4 a5 n: s+ V
- 7 |( I! i& E" R# B
- callLibrary(j, "listAccess", Tablefile);
, Z4 `1 ], i! M8 S+ C* k3 l! b - ; Z8 |7 B6 w6 q! \" U3 ]" x+ }
- print "Unloading: ", freeLibrary(j);; a) e0 p" Q7 N$ E8 i
- end;: q3 m: k. E. [' A
- end;
2 {/ h* P" C- d
复制代码 |