- is
' t* p# C% t ~ - r:real; file:string;* I% ?8 r8 p- N. o
- do7 W- I2 W; P0 Q& z; K; I7 {3 v
- openConsole;
% u2 j% z1 F3 h) g% } - ' V! }+ r7 R h. o2 K, X: d% s8 ^
- /*
0 P U- A3 r( B- X3 E# d, { - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
; q* Q7 m" j l* D2 }/ `, ~ - when is64BitApplication then 64 else 32,' o: g" g& _2 G K
- "bit.dll");
4 E$ w! W( o: y: n, I - */$ k: A; }! A. K! v8 a
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
/ y+ a0 T( d# V1 O& q8 T: | - local j := loadLibrary(file);8 ~+ X- t8 K* L! Z) ~
- / j! Z# g6 @* e
- if j > 0 then
( @' d: T: y, c2 m/ k% h. {6 j - print getLoadedLibrary(j)," is loaded.";
) O5 r: b3 R* H4 k, D& J, w
6 E" l5 b( x2 x% g# u7 u- r := callLibrary(j, "calcSin", PI/6);
v0 Y' Y8 Y3 t" d: \ - promptmessage(to_str("sin(PI/6) = ", r));
; W' d" P# s2 h+ ^2 n& L -
0 c) w4 Q1 t' ^- [9 @4 t - local str:string;" E" o6 n2 G# j3 b: Z% {5 B
- str := "I'm OK!";
8 M" @! A4 W/ W - str := callLibrary(j,"resetStr",str);
8 W1 x" X" [. O* B, m - promptmessage(str);
2 B% A# |/ `" n4 D -
9 }3 }( j8 q* f4 |6 X- \5 y - callLibrary(j, "listAccess", Tablefile);+ m* h) u6 X+ f3 ?
- : Z! p7 R* _/ D
- print "Unloading: ", freeLibrary(j);
" [* v' J/ U t7 d( h5 X) | - end;
5 ^- r2 w! ]& j& R$ D5 \3 k1 j - end;
, V; E7 o- m) Y* r9 ^8 S+ m
复制代码 |