- is
+ x& ^# d. i9 |. S# z# r% J& t3 a - r:real; file:string;5 q9 x" o% C; J
- do9 q4 D/ ]- C# q9 @/ {
- openConsole;
/ b7 W7 M6 @$ K0 u2 d
" z8 o' a! Q' L+ O7 n$ D- /*4 h# j: Y+ h- D5 q$ H2 V
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",3 }8 f" A, m8 e0 v
- when is64BitApplication then 64 else 32,
# h+ b/ F* C# ~1 S* h3 C( L" @6 q - "bit.dll");
2 P0 D0 ?4 n. }+ H& ] - */9 I. B) |& I) u3 t- F3 b% N6 I- S
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
/ B3 p( `# L4 v! @; I3 s - local j := loadLibrary(file);. K/ L9 z0 \- A2 j7 _2 `9 E
0 X1 [5 C: ^" t- if j > 0 then
( Y$ r+ o6 u& U% a, @0 F) x - print getLoadedLibrary(j)," is loaded.";) I- F' [" N+ f! }! l
- Y- ^* x$ i* m3 E9 x' R- r := callLibrary(j, "calcSin", PI/6);- B6 H: ~$ X& w; I/ }6 c
- promptmessage(to_str("sin(PI/6) = ", r));
5 I' ^: y% M0 D! n( E- } - h; ^ I( s3 h! M& h
- local str:string;
) h6 O' w+ V1 g5 M' X - str := "I'm OK!";
- f. q, p" k+ A* A - str := callLibrary(j,"resetStr",str);2 b4 \, T( Q+ j3 x- Y# ]
- promptmessage(str);
! U( b3 z/ p ?; C5 l) y0 m% q - * b0 z q Q* q" q" S% C+ ~8 F/ z
- callLibrary(j, "listAccess", Tablefile);
. ]7 X$ I2 p& K4 e$ l -
; m- D6 e7 F; D# ~2 q4 a$ l. i- d - print "Unloading: ", freeLibrary(j);) C' M, e5 n& y
- end;
/ r( q4 ?4 o. J) Y0 ]! d1 v9 w8 U8 _ - end;
& }& |5 x0 r( ~
复制代码 |