- is4 N' A) P7 f- a d7 n) ^% x
- r:real; file:string;
4 e( g+ q* j9 N7 K9 p3 s7 o B3 O - do$ G- F6 y% h O! h M" S
- openConsole;, g: C* ?5 [ d9 F) l5 J
1 g3 A5 a/ @8 D+ m2 M3 X$ r- /*6 s7 P4 T: ?* k" ~ k8 ^& ]
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
4 ]; e3 V: o/ R8 G$ U; J: j' b, {* m Q - when is64BitApplication then 64 else 32,
/ Z. e# f- Z) l+ [' c# K8 b" e - "bit.dll");; `3 [4 @3 Y" L' P G
- */
. G w4 y; A3 Z# C) A% w - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";* [+ Q _/ J3 Q
- local j := loadLibrary(file);2 V( y. w1 a; ~7 B; @6 W' G
3 x# { E& T$ x9 {$ m- if j > 0 then
4 O _$ ^# `" s, A. q T - print getLoadedLibrary(j)," is loaded.";
- I# v2 z$ j9 A0 c - # r( R) o: O- D0 Q
- r := callLibrary(j, "calcSin", PI/6);
0 w8 {8 D T, k# D& u6 x) H3 Y - promptmessage(to_str("sin(PI/6) = ", r));; M, Y; A _! l* f5 F
-
9 w* z) W0 ~. c - local str:string;; H" ?0 S0 a1 P6 Z& I' l
- str := "I'm OK!";
( O( ?9 ~. c( N4 h$ B. v# k - str := callLibrary(j,"resetStr",str);3 ], t9 o L) H0 b) v8 r" _- ^+ V0 X
- promptmessage(str);
( d" ^3 n5 P4 R$ ~4 k0 \+ B - % O/ b; Z) }& }: H, `+ e
- callLibrary(j, "listAccess", Tablefile);
- ]1 }4 E) T k: Q- [/ k -
0 n$ |. K! q& \7 E) F- E& G - print "Unloading: ", freeLibrary(j);& T0 z( ?% I2 j' j, q
- end;
1 m8 a1 `0 {0 ~7 T - end; c; j6 H0 l- |6 i+ G. ?
复制代码 |