- is, W6 l& g5 Y7 {; N4 A% T$ I6 P# S
- r:real; file:string;
5 K; W5 m7 o( F' t: s5 q - do
, H. r+ c. P% C2 V }: `/ F - openConsole;
# d( C8 B d( {( X - 9 d, r4 T# l$ Q: }3 |
- /*
+ ^# e- N- W/ p) g' y9 B6 J - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",$ X# v' n* H/ Y0 C9 v- K; a& k
- when is64BitApplication then 64 else 32,
' N0 C3 @( z. u! m5 V* ] - "bit.dll");
- _7 a8 m' n! j, o - */' D- F/ k+ ^* x1 g8 h+ S' ~
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
. O' T- a2 X4 l - local j := loadLibrary(file);0 }) q+ n; J8 x# I8 Q6 v) r+ q! _
+ p# I- M# S# x/ t) h# W4 ~- if j > 0 then
3 j, w' ~2 P; ?) R - print getLoadedLibrary(j)," is loaded.";6 M, d+ l2 I$ h9 C
- ) e2 G9 Q" q2 F" A: m& n
- r := callLibrary(j, "calcSin", PI/6);
6 Y" m/ @2 _: O$ | ` - promptmessage(to_str("sin(PI/6) = ", r));
' N9 e2 } h+ B! E+ X+ o2 }# w - * u$ P. n4 \: k$ Z) x
- local str:string;
, R0 W6 x' ?+ H5 {$ a; q1 @6 t# H - str := "I'm OK!";* m5 w% K7 k/ j- Y: F1 _9 w4 ?
- str := callLibrary(j,"resetStr",str);
. L& x( W* v" `5 w O7 O2 z( R - promptmessage(str);2 `# c8 l0 Q, r5 ^- i8 S" `
- " z8 p6 }7 J2 C9 p( J
- callLibrary(j, "listAccess", Tablefile);
5 s( w7 c& M1 u0 ]& G. O5 u - ( y9 q* ^6 ^/ c S; V
- print "Unloading: ", freeLibrary(j);
/ |8 Y8 l6 U+ @# ?, d8 P) \1 e - end;
1 X- x G2 ~. | - end;
, S4 _7 X6 T3 w4 @9 Q' }8 g
复制代码 |