- is
/ n, m) l& |& A8 o% o5 f - r:real; file:string;2 b4 B' v$ i( w( Y3 j
- do
" a# G; l2 G+ ^- _) @ - openConsole;7 l: v: }, D) {7 Z3 d+ E, l$ B. v
- - i2 u3 i* R( n8 e3 D0 v# `
- /*
# U* [5 d; {3 o" F8 S8 ~: {* U5 h6 Y - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",: `: {! R5 C; E8 J( b$ H
- when is64BitApplication then 64 else 32,
: C) R) v! S: g- X) e - "bit.dll");
# X0 d6 D/ n/ T5 Z* _7 q' N - */3 `* f$ Z4 n) E9 Q1 W
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";, T& j4 g/ Q! p" D- q0 F, h
- local j := loadLibrary(file);/ r9 S) \& w3 v# |5 A7 p
. g6 d# f% B x4 _8 a9 @6 D- if j > 0 then
2 q: O* W! `0 v7 _ - print getLoadedLibrary(j)," is loaded.";
7 R1 D1 K8 x8 k2 T4 @& x7 {. _
" D! ~ s5 L, A! ~, g: T! _! w- r := callLibrary(j, "calcSin", PI/6);& R1 F3 j( M$ B. X
- promptmessage(to_str("sin(PI/6) = ", r));
j. k; y, j3 K - % k' ?9 h k6 n( j, |
- local str:string;! u0 B$ y6 I) S+ D
- str := "I'm OK!";, W) K1 L9 w4 X! Y3 S1 _" [
- str := callLibrary(j,"resetStr",str);/ j1 t r$ X I0 m9 h
- promptmessage(str);! p; H+ S$ Z- ~ b( ?
- 7 i6 q8 k4 O& M# O2 K7 Q
- callLibrary(j, "listAccess", Tablefile);
- O8 U5 a0 V: U( e+ `; h+ j3 N -
) g: Z, h5 `. L c9 r - print "Unloading: ", freeLibrary(j);
0 h3 G. C: h5 K1 C0 t e( c - end;1 _; [6 G7 @! X0 u. Q4 _% W
- end;
& h3 r9 ^3 q! c( \( [/ _
复制代码 |