- is
4 f7 A% O4 Z/ N# X" }6 s. v( R, E - r:real; file:string;& l' G! ~, Z% T1 _! [/ w( T
- do6 `7 r0 A# n2 k* C: N1 A
- openConsole;6 H" t: n2 s) o5 @* M2 Y
- 0 O3 b6 x1 t/ n x9 j
- /*8 ]2 m, J l# z) k9 W8 {, d
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
# A& K" f3 ]0 Y0 O+ {+ I - when is64BitApplication then 64 else 32,4 L/ j6 j& b4 l+ v& y) Q
- "bit.dll");
' X5 z d8 ?' X: {( A - */9 q* C. u* w: S) {; X5 \, T) h
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";. O+ W+ c/ l. v/ U: N
- local j := loadLibrary(file);
, ^, @9 K7 V6 ]1 H( H0 X
5 f. J7 Q6 n ?9 r k M1 D- if j > 0 then- \: ^. Z! ]4 D0 A# Q/ [' y
- print getLoadedLibrary(j)," is loaded.";
$ f5 A. U6 P1 v! A3 A! J/ d: w# G
: a7 T3 M6 U" }! H( {- r := callLibrary(j, "calcSin", PI/6);
) K4 h) _) \, k$ d8 K( Y - promptmessage(to_str("sin(PI/6) = ", r));- z6 X: t1 V' f6 T3 U Y
-
4 G2 [# h4 t n( h8 E1 v - local str:string;
5 } K! E2 q! r+ t) u" s - str := "I'm OK!";4 w, Z" J2 [2 y0 @/ u% j6 Y
- str := callLibrary(j,"resetStr",str);
7 i. w& J9 R3 _, q - promptmessage(str);
+ j3 `* ]: S3 {: v3 p& ~ -
7 x* y. X, A& B6 x C3 u' i3 G: D8 d - callLibrary(j, "listAccess", Tablefile);7 k0 C# E* B: [, ]: X
- ) J9 i" M7 D7 J8 z- D- v
- print "Unloading: ", freeLibrary(j);
$ n7 A& W4 r$ }; V' o) ]; t+ ] - end;2 ~/ e; R2 @* u' N1 y- m+ A, Q
- end;# F& {1 W2 i' q5 I& }. f2 \$ }. {
复制代码 |