- is
7 @7 y2 N, F) v# i s7 g( | - r:real; file:string;
+ f8 D4 ~5 r( l$ p( @- r7 K$ ^ - do
_0 n! @- j0 D - openConsole;, H$ n0 h0 O$ Q. V
# D+ U0 g: h; O7 u+ Q- /*
" |9 J) b& r! o - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",* _8 l4 {( W2 c, p- j7 T1 d |5 \
- when is64BitApplication then 64 else 32,- g6 T. ?! d' D' R
- "bit.dll");4 B H- s* z5 T0 Q
- */
/ P$ K ]1 V5 ` _ - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";8 |2 w- s; b$ v0 i- c: M h
- local j := loadLibrary(file);
8 Z* Z( d& ?! [: c! Z: R: I
1 O H6 I3 ~ x7 _$ c- if j > 0 then
e6 F" p. V4 B: E' r4 L* _, N9 N - print getLoadedLibrary(j)," is loaded.";
( k, n% H% Z3 ^) ]9 k/ F
# |" k- c! S5 g; M6 l9 Q- r := callLibrary(j, "calcSin", PI/6);
) M) Q3 j5 J, V; q: l4 a- S - promptmessage(to_str("sin(PI/6) = ", r));$ V2 W8 L1 l! O. O$ Z" c
- " w% n! ^7 ^, ~, `; P# r P
- local str:string;
& _+ Q6 |: e6 B0 I! s - str := "I'm OK!";3 N* a2 t! \7 F8 O! T4 \5 i
- str := callLibrary(j,"resetStr",str);
7 z0 ]; y$ X* e% q0 [( E& V9 S - promptmessage(str);
$ N1 f5 s! v- j- T9 f: R- _ -
* T1 l6 E: ~* S# N - callLibrary(j, "listAccess", Tablefile);
) O' T$ w$ i o; @" E2 L& b$ m -
$ n9 U) z4 M$ _0 x0 H - print "Unloading: ", freeLibrary(j);! }/ _+ `9 }/ [$ L$ D+ [
- end;
0 z# r% M! T$ w. C - end;
4 ~6 W9 `+ A0 ?; |0 z* g+ P
复制代码 |