- is
5 J! K( @% f5 H$ Y - r:real; file:string;% H4 n6 j- v) a
- do
- i0 X4 P" O+ h! f. k" g% m - openConsole;* ?/ O3 p2 h; K+ g3 g
. \& e2 P9 T1 M: z" g- /*
2 g) u/ x5 d! i) T% t - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",5 _( y; q" O" e. o; A
- when is64BitApplication then 64 else 32,
8 j6 E+ c4 z, ?8 z - "bit.dll");4 s* p" m0 N- ~" J1 R: \
- */. u3 Q, S! @5 T* N/ @- x9 J
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
( n$ \9 L, @. G0 v' K- N - local j := loadLibrary(file);
8 _9 y& d8 F: r+ @ - 9 i/ {; M- e% w+ `6 t
- if j > 0 then. P Z2 V9 x* {( X. S
- print getLoadedLibrary(j)," is loaded.";
& f7 y7 p, G4 w- {
+ p9 e5 F9 r- ~- r := callLibrary(j, "calcSin", PI/6);
% K2 ]1 T0 W: v, d - promptmessage(to_str("sin(PI/6) = ", r));
# g9 i5 {' n" [! I" `5 y; b - 3 z& [8 Z$ E& L* W z* U* ]5 s7 v
- local str:string;' U4 @9 U8 v! Y/ J) ]" _2 E; j
- str := "I'm OK!";
6 E# o& r7 w1 f( N - str := callLibrary(j,"resetStr",str);! M. X! c$ D$ H6 R5 x& |; H4 N
- promptmessage(str);$ o9 t$ r4 d; N+ Y5 o q4 }- S: g
- & K7 Q o$ }4 O5 Z$ h
- callLibrary(j, "listAccess", Tablefile);
, Y' @" X+ |; v' P, a, V -
2 q9 T% o* ?9 y" s3 {4 r - print "Unloading: ", freeLibrary(j);- z' B5 g& \9 L5 |0 u+ ~ Z* L
- end;
B7 V0 Z. V4 `. o9 ]8 L+ i - end;9 O* G4 _& M3 g
复制代码 |