- is
, f: m, V" ?, g1 T+ _; C - r:real; file:string;. \- ^2 @! H) p& h
- do4 L; {$ I( O" r! m, ~; S
- openConsole;
0 v2 q5 H+ ?# t6 l( n# c - / J" Y- o( z b3 e5 s) d
- /*& A$ [3 K6 V1 S) n: g
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
# f) m" |$ a+ }9 r, n" T - when is64BitApplication then 64 else 32,
: T$ o1 s. c+ Y" y1 I( g9 Z - "bit.dll");
3 M+ j! ?9 A/ J6 N0 v - */) ?1 {9 j4 L) q; M0 p
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
: Q2 U+ T2 V% ~% y; j9 e - local j := loadLibrary(file);
4 E2 B3 F! G$ h* [; E2 F% c8 J - ; p: ^( a5 s) r( S3 R7 g# x
- if j > 0 then
' B, I- u; u2 c T - print getLoadedLibrary(j)," is loaded.";; P6 r; Q, ?& m7 ?1 u6 A
' Y! j5 F' e# |0 d+ o% m- r := callLibrary(j, "calcSin", PI/6);
4 d2 _$ b5 d, }$ \ - promptmessage(to_str("sin(PI/6) = ", r));
. G- U9 H, S9 p! d1 }, u - / c% T; B0 h' ?8 ]
- local str:string;
/ M: ~7 u, ?/ ?2 y7 H) V - str := "I'm OK!";
: R, m0 E2 ^# v# D9 } - str := callLibrary(j,"resetStr",str);
3 n% y3 W" i1 t9 S. L( o. z. y- b - promptmessage(str);
) z, \6 d% c; G0 o$ K& n# X' r - * d2 x+ ^4 v2 b) y1 g& h [
- callLibrary(j, "listAccess", Tablefile);
6 D6 u/ x1 ~0 ]" m -
6 h2 `$ j1 r0 t# [: }# r+ y# x1 _ - print "Unloading: ", freeLibrary(j);5 v B* c9 y, ^! Y: ]
- end;: A: N& ?& G; N1 P; e7 f! n
- end;9 ]9 ~0 c1 I7 t& j7 |& p& I( B7 ~
复制代码 |