- is5 B1 K& S8 V/ X, ^( n& y; t' L
- r:real; file:string;
7 p a% x* v' w - do3 c- b2 _' _) _/ p9 w4 `
- openConsole;8 n2 k, `0 j: i: V
! s# r0 @: Y$ t8 n$ s* V( A3 Q X- /*
2 q& ]8 Y% W' A6 a, K, |( p# U- g - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",0 Y, x8 M g0 K, i1 f( K0 x
- when is64BitApplication then 64 else 32,$ Z, V$ }, Z/ j# [
- "bit.dll");
. ?+ l- W4 Y- y6 s1 E& I9 n7 }2 e - */
9 l$ |' p2 S% D - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";; g7 P0 [. M4 @* D- O# l) ^
- local j := loadLibrary(file);3 @& X$ j9 g. L$ ~
2 t' f6 }' r2 h& J, V. I/ q- if j > 0 then
9 g2 e/ c, S' F1 u1 M' {3 s9 u - print getLoadedLibrary(j)," is loaded.";
( q) b C6 A) u' O q W - 6 p! v6 Z( i+ _! t
- r := callLibrary(j, "calcSin", PI/6);7 Y: q b2 B. y) O1 X
- promptmessage(to_str("sin(PI/6) = ", r));
* V3 o g7 C7 o/ R9 ]8 g - * [$ F4 [+ c/ ~+ E9 {% R
- local str:string;' o# D9 ^( u* ^7 m$ g
- str := "I'm OK!";3 h/ B3 S7 h6 k2 Q& {
- str := callLibrary(j,"resetStr",str);% ]9 I6 l# m" m+ s5 c/ _, B* w
- promptmessage(str);" ^9 G& b9 a; W
- 6 Z; K& g" u+ `! d
- callLibrary(j, "listAccess", Tablefile);
4 S! J) `9 W& N8 I( g - 9 x% J1 j5 n' L7 P( r
- print "Unloading: ", freeLibrary(j);* ?+ N; M2 o/ B S; d5 d% ~
- end;6 A$ k' M/ P' |
- end;. L7 ]$ w7 G5 ]' G0 E# G
复制代码 |