- is
. F! @3 J4 Q% e - r:real; file:string;$ j3 H0 J! D" }$ O7 C
- do
% g* `2 n, w4 _1 k! }# b; r2 W! k - openConsole;
F+ c( d9 O' a! H) ?
9 x/ L+ E" B/ z( c$ q% e' }- /*5 E7 G5 g6 m. B( s
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",# a+ L% z( B' u) Q, X8 p# p2 g$ n
- when is64BitApplication then 64 else 32,
. x$ ~5 a: Q. j8 ] - "bit.dll");! [- v4 \) K# l' @% H) a Y5 l1 M
- */0 l n( v- o: q% @
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
9 ]0 F$ C- f1 A* B - local j := loadLibrary(file);
3 a% C6 N. Z1 z1 S& }- i - 4 n6 K; |5 B/ }
- if j > 0 then
- b7 b! X5 X# A* S# W2 |2 ^& W7 C - print getLoadedLibrary(j)," is loaded.";$ Q. h; M! v3 g/ e; ]* [8 g1 n
5 G; n. j( J) O, r# p6 c, `/ C% E+ w- r := callLibrary(j, "calcSin", PI/6);
. G4 ?% G7 _" g* V# r0 z; |+ Z - promptmessage(to_str("sin(PI/6) = ", r));
8 w0 ^: F) W. E& J - 2 \. g5 ^+ T8 v" ~, v4 E( o v# N5 M
- local str:string;
- X' [. d9 U' t& Q$ g" } - str := "I'm OK!";- s5 X, E& T, I3 j& I
- str := callLibrary(j,"resetStr",str);
, F( l" k4 G9 x: y) x9 y - promptmessage(str);
: r3 U: `3 @9 ~9 O' b9 Q) I - 8 K4 A6 M+ H5 Y9 q% F
- callLibrary(j, "listAccess", Tablefile);: p3 _, B" W6 W% Z% [
- . T5 F3 K4 g) v: L
- print "Unloading: ", freeLibrary(j);. c# b$ d+ F, s; Y, j8 q6 p) m+ q
- end;
! R& ]3 I, n! ~9 u - end;
+ F3 r- |. m+ m' F' X. @
复制代码 |