- is2 F( ~9 N( v# r9 B
- r:real; file:string;
8 E( P# S e6 H6 b - do H* z! l( [. O" _3 v
- openConsole;5 J# a' E [0 q2 t( M8 N: c
- ; k1 M2 A: U u$ I5 N3 q/ F2 r8 g
- /*8 d+ Z$ a: s2 v1 d( ?
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",# r2 j/ V$ c4 P. K5 g
- when is64BitApplication then 64 else 32,0 b0 @% ~7 N! z
- "bit.dll");
4 Q. }9 A' ~$ t) L- W: g - */
" [* `0 ?( r. H, R1 H8 R% } - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";% A) g8 J# |2 }8 }
- local j := loadLibrary(file);
% i4 I" @2 ?7 S6 g. u! ~8 g# Z
0 ]! t" X! E4 z8 d* W/ \ m3 l! D- if j > 0 then! i2 u2 E/ m, \
- print getLoadedLibrary(j)," is loaded.";
- D/ U! p- s5 f# Z2 l' R
% p* L* e' I1 M2 c- r := callLibrary(j, "calcSin", PI/6);
J6 ^0 d! [/ H - promptmessage(to_str("sin(PI/6) = ", r));
8 d$ h5 g+ G' y8 x0 u" p+ ` -
" a; N3 y G7 l# v/ B4 E3 }+ {2 u - local str:string;
; F* {* U6 ?4 O3 k5 w4 | - str := "I'm OK!";
$ z$ d6 ?5 [ f9 F+ w - str := callLibrary(j,"resetStr",str);6 [( Y. F! j3 ]3 ~) U* x
- promptmessage(str);
6 d! i3 n1 D" z: k - ! T. G9 K6 c6 W' c6 }
- callLibrary(j, "listAccess", Tablefile);3 p# O0 D# B: c$ C+ y
-
6 ]5 M9 h$ W/ r! A) C+ g - print "Unloading: ", freeLibrary(j);
5 p# A3 s5 u! @1 {/ H0 h" Z - end;( R( K* b0 z4 [: m! w# l
- end;' G' [- f4 e( x, \/ [; G" v
复制代码 |