- is( F! z' M3 @( e
- r:real; file:string;5 c u a2 _, m, r
- do
7 Q# v! T' j: W e) R - openConsole;0 p; C" d% z. j' m% C
/ t5 U! J4 e; @- e) f [- /*
/ P( ?+ D }4 h2 ` - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
0 Z5 s4 l3 c! a9 K7 ~1 P - when is64BitApplication then 64 else 32,, w. G' x2 P" R
- "bit.dll"); q, @5 F: D+ O) h1 ]* C
- */
* O0 @2 I4 r, Q3 ~ - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll"; X# @1 W# }, _
- local j := loadLibrary(file);. T$ ?' S3 F, W" A
# v5 U9 v& [+ N: y9 q- if j > 0 then
B% g/ _1 K( T( L# T4 r) D9 c - print getLoadedLibrary(j)," is loaded.";1 q3 N# h; ]5 ? k
- # M0 ]. G% f& ^$ e" [# B/ b
- r := callLibrary(j, "calcSin", PI/6);
+ U/ U# T( a* e8 d) J8 i, M8 R - promptmessage(to_str("sin(PI/6) = ", r));5 c; F$ D! t6 K
- " r6 ?: f5 l M! \4 t
- local str:string;$ ^3 b0 Y8 u# X5 Z
- str := "I'm OK!";( X3 h! Z/ O4 L: `0 z
- str := callLibrary(j,"resetStr",str);( Z$ e, d' m1 _5 }
- promptmessage(str);
! D) q( _6 T4 L1 K/ v -
3 v: D( w0 [% f+ T, U8 k3 i - callLibrary(j, "listAccess", Tablefile);
- D; O- E$ z' ^# Q/ q -
- l2 D/ W1 B- p, w% ^ - print "Unloading: ", freeLibrary(j);
m5 n7 q. H- N% F- a0 j/ x) I - end;
; ]# A; E- Z- R - end;8 Q; d! D; F3 g2 m/ i! m* o0 ]) d
复制代码 |