- is/ k S' v" n7 F" V
- r:real; file:string;
- @- z; _( l2 w* G! E3 K( R - do
9 f8 _7 ~$ N/ f: d$ m8 l G - openConsole;0 X0 F, S$ m# ~5 F4 _5 I% H% A* P
- : r4 u( l* q3 L0 f" c# G
- /*; U" \5 s" n# ?) ` b+ t
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
& W* h" `3 g) `. h - when is64BitApplication then 64 else 32,; Z9 J& D+ S. u1 x ^5 \! Q
- "bit.dll");
3 u' R9 M8 z/ A* R2 B' O - */5 K! ^/ c/ C! Q$ W% h
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";5 L: b. D+ U9 F3 y7 o8 {
- local j := loadLibrary(file);
2 F6 S7 y: h% s( L; ]. N
% Q+ s' D4 y6 X7 R9 `% K$ N- if j > 0 then9 @# a& n6 p6 a4 l9 C
- print getLoadedLibrary(j)," is loaded.";' j) E/ U- |* g" ]6 [0 _
- % z3 | @+ R# k. I( u) i( v
- r := callLibrary(j, "calcSin", PI/6);
d% H& N& ~' ?& j; b: ]5 u - promptmessage(to_str("sin(PI/6) = ", r));
+ {( Q- S+ s* J) L5 e$ M9 n0 H -
2 x) u8 d D7 W* O - local str:string;
) i# M; D; ~8 x3 r - str := "I'm OK!";
$ G9 O+ U3 |+ ~4 s - str := callLibrary(j,"resetStr",str);
8 v( H) E, ]3 j! U! { - promptmessage(str);2 Q n$ {; _. h: n6 T/ q
- 0 P6 a. O a/ ^1 ~ \, K. _
- callLibrary(j, "listAccess", Tablefile);3 s+ l S9 l1 s, p" R3 v
-
. d$ C0 ^8 z# j, w - print "Unloading: ", freeLibrary(j);$ k0 K& P/ x0 Q$ D
- end;/ D' e n1 g9 b/ Q, F1 z. K
- end;, u0 `& K* j; q$ |
复制代码 |