- is
2 S! I5 B7 p# I* B) Z - r:real; file:string;
4 Y/ Y. s, g. k" v - do4 ?6 N/ f. B% m T% a
- openConsole;
2 O: u+ E# i, ~7 x( @) K - 0 a* h' X. R7 t s; ^# V8 C4 h
- /*
$ y+ n# |% v8 v# B( X - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",3 A# V, ^2 B: ?) `1 a& u
- when is64BitApplication then 64 else 32,
# ]& D) b. R* C5 I! X - "bit.dll");
6 o& i! D0 r0 a' T* I - */+ R+ g6 h1 J5 w% f+ Y3 O
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";! W$ y$ M; W3 o" D4 m. i3 }( m
- local j := loadLibrary(file);
8 B2 a) C! r, D7 B, q3 Z/ K - $ Y6 N9 d9 |( Y% h) k2 L
- if j > 0 then8 l" b+ ^2 K5 E, w4 o& ]
- print getLoadedLibrary(j)," is loaded."; y+ t7 Z$ k5 y+ T$ w9 u
. [+ K& d; E1 ?4 R6 S- r := callLibrary(j, "calcSin", PI/6);
' q }' _) w Q x+ T9 J( P0 q, z. W; y - promptmessage(to_str("sin(PI/6) = ", r));+ |- ^& h) \% i# s: Y8 z
-
& F. v; E1 x" N; m* c" t ^ - local str:string;
# R5 \+ Q' R2 D - str := "I'm OK!";
. T3 D: E6 v* T/ A - str := callLibrary(j,"resetStr",str);
- ?- c g# {; _( I- Q0 \ - promptmessage(str); E5 m# X1 T/ \. I
-
/ z, _. s& Z2 Y5 p - callLibrary(j, "listAccess", Tablefile);: y! X, g% i+ W7 Y6 G0 f
-
' } ]- V$ I+ P3 @0 e! n( T - print "Unloading: ", freeLibrary(j);
( } S& b: Q" V( [. Z; K - end;
# G. i$ ^, I& u" d/ {$ e0 C% H2 _ - end;
9 I; |& w$ i0 x" y( Z1 T
复制代码 |