- is
9 I2 A% q! Q! u$ ? - r:real; file:string;5 H" F; D8 @9 _7 Q3 s* m
- do
3 n3 x6 Z1 F/ ]+ `, T - openConsole;4 K1 N6 @, {' {( S, H/ H3 z4 D
- ^9 o( O. Y- |, W. }. N3 j6 t- /*
, W4 T: b$ z" O5 D - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf", J0 j* s" r N6 Q' [+ e: @! }. {
- when is64BitApplication then 64 else 32,
, h/ z6 s! ~6 ^. x4 d* L; z - "bit.dll");
/ ^: g8 X" G5 k, V. y/ o3 L6 K - */
i8 t( b# D2 r M8 Q* ]+ f - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";* J* }: L: _; S) Z& Q. K/ a
- local j := loadLibrary(file);! Z# v2 ^! R k8 g- i/ D' D9 S0 K3 h
. C# V! \8 F6 `4 d6 j1 G- if j > 0 then: L c, e! u, z0 J
- print getLoadedLibrary(j)," is loaded.";
# x$ E! ^7 q" r/ h/ r/ _
1 i4 f# r4 V, a6 a- r := callLibrary(j, "calcSin", PI/6);) T+ a2 O, }0 X- ?1 k6 m+ k7 z
- promptmessage(to_str("sin(PI/6) = ", r));
1 c. v# B1 b" X- u$ E* K1 L5 i% A* m - 3 e6 k& e) Z; x0 Y7 \; r
- local str:string;6 H* |% x2 R2 C$ u9 ~# l
- str := "I'm OK!";9 y3 K4 S# d4 ?7 I% Y! B
- str := callLibrary(j,"resetStr",str);
8 \ O$ N- z. k3 h4 e( p- Z - promptmessage(str);$ m- w& o1 c( b7 m1 J- u% A5 _
-
7 c8 ~5 ?3 X- a( C' I - callLibrary(j, "listAccess", Tablefile);
A! I1 s6 S w -
% d5 p1 n3 {/ k - print "Unloading: ", freeLibrary(j);
. I7 H4 g) i1 r, R - end;
7 i7 P) F8 G& C4 @( W - end;4 K+ f1 E! [/ j1 U
复制代码 |