- is
. v2 f. L6 Q4 I) w' @+ L" y - r:real; file:string;8 m4 W! I# [% f
- do
& S0 x& g8 c3 Z: s7 ]8 y - openConsole;
$ `, z' G6 x) G" j! X7 A* W
# t: c+ _, w2 V% C0 S- /*; T) _9 n6 }. w! g
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
7 {1 A4 ?$ F7 K* s5 U" |4 u - when is64BitApplication then 64 else 32,
% T6 J4 }7 p# ?% n' |8 d - "bit.dll");
1 G2 C9 O9 J$ u, n$ n. g/ [ ?& H - */
$ E" O. Q# _7 [6 Y! u' p3 z - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";1 e7 W3 d' s& Y- a- r* {: ^+ U1 I# y
- local j := loadLibrary(file);7 O+ m7 k* G+ h2 s2 a% y) D; V1 S9 @
- Z* {% j& w) C% \
- if j > 0 then
$ ^% `1 L$ K- H O" `0 F, Z | - print getLoadedLibrary(j)," is loaded.";
' d) U" G; ^ j - 2 E2 \* B$ A/ I1 a' g, d. w% w1 J
- r := callLibrary(j, "calcSin", PI/6);3 {% y$ a6 k3 p' L) ~/ G* Y% `
- promptmessage(to_str("sin(PI/6) = ", r));
" O, v( t0 a# h; C( L1 S! g - 8 \8 @- j; S2 h% Y2 s
- local str:string;
$ P& _. s& T8 N6 k6 ~, c9 i - str := "I'm OK!";
% K0 P" x: _" ~- h% K7 J0 O9 @ - str := callLibrary(j,"resetStr",str);
5 X# x3 u3 J8 o% @ - promptmessage(str);
+ }" A" K5 C, w5 K -
1 R" {9 p ~ ]# l( J+ [ - callLibrary(j, "listAccess", Tablefile);
$ J# O, ]' v1 u7 Q - 5 J! s" B! y6 u) M3 x
- print "Unloading: ", freeLibrary(j);
# f4 y/ g; o6 }8 T& b: p - end;3 ~2 @+ |8 }8 I) Z5 h
- end;' v4 X& K Q) Q, ^
复制代码 |