- is6 w7 z3 e( W% _ i" N1 h* v
- r:real; file:string;/ e; M# Y4 {# t# G) ]3 T V
- do0 a/ g: \6 A* {: [! f. Y' I2 v7 l7 A
- openConsole;
( }& c; H3 Y, Y; L. G2 {( Y
$ l7 T5 E$ U4 H- /*
9 \8 l" M+ w, N1 e6 `/ m7 K) a+ U - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",; c% i/ b; H0 i' V S
- when is64BitApplication then 64 else 32,) _( ~6 S9 o D& E, u/ {
- "bit.dll");" i/ n. I$ _4 o, Y4 T1 {; f; x$ z
- */& p3 P }! i' W* u" `
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
7 }- [/ T: u, U5 j; l - local j := loadLibrary(file);
" v7 u( N- s& k& Z8 w - 6 R& n& ?# ]7 l' B* \8 {0 H
- if j > 0 then
$ C2 e0 n* L, k - print getLoadedLibrary(j)," is loaded.";
- ~( ?9 d2 q/ M% {, ?0 Y2 X - ! l* ^* r1 R/ g# v# S7 \1 k
- r := callLibrary(j, "calcSin", PI/6);+ b- ^- Z- H- L. e- I' V
- promptmessage(to_str("sin(PI/6) = ", r));
% n2 \& {, d% w8 E2 `+ j0 K -
) J3 p* Y6 A* R9 S. ~1 C$ ?) l1 ` - local str:string;" D3 [3 s4 ?! ?) X% M
- str := "I'm OK!";1 b y/ q) L# }- c6 i* I% O
- str := callLibrary(j,"resetStr",str);$ j1 a& ?5 N4 h
- promptmessage(str);
6 n0 m s3 o) a. w -
1 h! Z5 }% Q. n4 \ - callLibrary(j, "listAccess", Tablefile);
2 P4 P/ P; }, z9 f - % p' K2 F0 C( u. d/ }
- print "Unloading: ", freeLibrary(j);
$ X! c$ W( v# v! B9 M! w - end;& b9 @7 t, O+ H3 @
- end;7 t( {) T$ `6 O
复制代码 |