- is( q2 p' o* ]* a: z7 Q3 D4 c
- r:real; file:string;: [# K$ ` `6 S
- do& C1 N8 S2 `( p
- openConsole;
& V4 E' q8 v% H% h5 Y* O - ) X1 ]: w1 }$ R# {& \
- /*. Q1 u; g+ k1 b/ Q
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
0 L+ A4 S* V7 S$ ? - when is64BitApplication then 64 else 32,: ~' g# V2 L( [. P
- "bit.dll");
3 K+ O! y" ?( @1 s R! @# D - */: o: F4 H ^! C( w" \0 |6 U x
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
7 y5 f4 `! G2 m0 v& R6 K - local j := loadLibrary(file);
; D6 I( S' h* o, s; q3 l9 N - 9 G! t( V- C! s8 H5 n& M. l! f
- if j > 0 then
( P4 B! V4 h6 h- g - print getLoadedLibrary(j)," is loaded.";
0 ?1 D6 T( Z$ V - 7 I, a8 q& h- j: I% ?' j
- r := callLibrary(j, "calcSin", PI/6); p& _* p5 k8 _* p, Z' n' P0 T
- promptmessage(to_str("sin(PI/6) = ", r));
) I {7 S5 J* `: v( p/ C8 ~( X -
( x- v. N4 V( ~4 T, ?1 J - local str:string;
J; ~7 g& n+ l+ Y - str := "I'm OK!";/ C) m& p1 Z' v$ H8 D5 W. {% `
- str := callLibrary(j,"resetStr",str);
2 T3 n3 T; h2 y - promptmessage(str);$ M; z5 D2 A8 Z: a# g+ O
-
% b+ L/ v" I3 `8 S9 p" G3 h: P - callLibrary(j, "listAccess", Tablefile);/ H& W" d0 u+ S/ ~, [
- 3 I' [% R5 X' Q* Z8 ^
- print "Unloading: ", freeLibrary(j);& _' O: F7 s" z& L+ c
- end;
* w7 \8 D7 H; M" b, Z6 {( C" S - end;7 x8 S6 K3 K1 x7 S: c$ p
复制代码 |