- is
; [2 S* z! J6 o/ Y5 j3 G& F - r:real; file:string;7 K2 p9 A) B" M+ O- G
- do
, `$ V% U) E/ i$ P6 b4 j - openConsole;) r# W3 h, {, n( j0 S; U
! O8 U6 ?; G% I: H! B' k: h" _7 ?- /*5 ?9 g6 B1 B' v) G. p
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
4 J" l' J/ t, \0 t! N - when is64BitApplication then 64 else 32,3 I1 g! h" i( m7 L
- "bit.dll");1 F* C8 \8 m: E r# ~8 v3 p) [
- */
4 [8 X, o/ L! ]" H* d+ p - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";" z; f$ j- k" L& [. _7 J
- local j := loadLibrary(file);5 G* S% `5 k; d( L% a
- # K/ _( Z+ t, L
- if j > 0 then# {8 ]! e' t, ]3 q3 }( e- _% F
- print getLoadedLibrary(j)," is loaded.";0 ~9 C2 b" \* o: F `
- 2 O. y: l9 r& W
- r := callLibrary(j, "calcSin", PI/6);
- l R/ Y' g r+ { - promptmessage(to_str("sin(PI/6) = ", r));$ h6 b1 I1 t$ Z) k1 V5 q: f
-
! [; S& e$ V |4 q" R - local str:string;
. D2 T6 v1 f& }& r- P3 Q - str := "I'm OK!";
6 L1 g! L5 Q8 L - str := callLibrary(j,"resetStr",str);
6 |, f6 \( t% w4 k& C6 v$ j - promptmessage(str);
% T; _! M$ f2 M( y/ ~ -
! ~; U+ B, i) T7 R! a - callLibrary(j, "listAccess", Tablefile);; Z! S0 d" J& C( ]: f
- % L3 h, z0 b3 e! O, f8 f
- print "Unloading: ", freeLibrary(j);+ ` S& z7 S t/ u
- end;
8 S* }* J& i6 I% m - end;( R1 s5 ^$ @) \2 { q# D
复制代码 |