- is4 q1 I! k" Y- Z8 f/ f j
- r:real; file:string;
! B4 G1 g# Y( j: [; @1 K# b - do
# g, e8 Y0 W; g - openConsole;6 p; r9 A. B& S6 u/ a
* P1 m. B) u" B' J; S: l+ r- /*
6 f2 B$ D6 e+ g0 m% U# ^" e; s - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
! z; o9 n h' i - when is64BitApplication then 64 else 32,4 n; ]7 X7 R7 ]# a/ j
- "bit.dll");" {2 ]& e J, h' y8 a, Z: z3 c
- */
3 ]0 s% }+ `6 V( ^1 V - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
2 C" R1 C4 ?% H7 Z - local j := loadLibrary(file);
% Z4 {9 }, b' g% |+ w
& j, b0 r3 T( U1 C6 y: ]6 D- if j > 0 then' ~9 \+ D7 ^/ @. ^
- print getLoadedLibrary(j)," is loaded.";+ T3 I' ^, V5 [
- 0 _3 x" V6 V/ R* E# r
- r := callLibrary(j, "calcSin", PI/6);
$ a, F2 g8 A( D8 ~. G) m+ ~ - promptmessage(to_str("sin(PI/6) = ", r));
7 n+ g8 ` d$ ^* l% d -
" v3 J# B" L; A+ ~. t8 m# X - local str:string;" L4 w$ n v. C1 N0 a
- str := "I'm OK!";
' J, \, g! g: o/ S5 f f - str := callLibrary(j,"resetStr",str);
+ `6 f- T) J6 c4 U5 \8 a - promptmessage(str);
6 F: M8 d) U$ k* ~ - 5 T/ i: [( P% r: |
- callLibrary(j, "listAccess", Tablefile);
- P$ J# ~* Q- ^; @1 h - 2 S [, U6 `$ A1 Z) U) k; Q" o' U
- print "Unloading: ", freeLibrary(j);8 }2 P8 i' {# o, D
- end;
6 k. U Z, i e - end;/ L8 E& x5 H0 z0 O( H
复制代码 |