- is
2 n' E& j% Q! R( E3 W4 N5 l - r:real; file:string;6 M9 s; i) }' D- h2 o
- do9 W% M) F/ H8 U: M
- openConsole;
C& s' _; D5 ?+ X - 3 e" R. P; g4 V4 S0 M
- /*' i; a3 J, q' S- Z8 M
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
. ?/ v2 c6 y: y! P8 {6 m" _ - when is64BitApplication then 64 else 32,
7 F: n0 k: Q, P! N& X( a. v - "bit.dll");+ X: [ h7 O! k9 f' ^1 c
- */
1 y2 p+ _; [3 k8 N( J - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
. Z0 H( ]# ~3 T - local j := loadLibrary(file);
$ b# t* I; E- u& Q! E0 ^
- M9 h- B+ |+ W4 C: I7 p- if j > 0 then
/ _- X! R! @9 X: d - print getLoadedLibrary(j)," is loaded.";
a# S' |% v7 o; L& f( |6 T' z
% \$ ]7 y$ ]0 g" f- r := callLibrary(j, "calcSin", PI/6);+ a9 ^- f( u0 t
- promptmessage(to_str("sin(PI/6) = ", r));
2 d1 D, W; s2 o n& I% A2 V: U. Q/ Y - " H+ Q. U3 i# X( m5 X
- local str:string;3 Q b Y! O+ m% {3 ? i! H
- str := "I'm OK!";
& `, E8 Z$ u9 u: s" B - str := callLibrary(j,"resetStr",str);" @' D! f4 F+ e3 |7 j& N
- promptmessage(str);! ?$ @. c5 E. g4 [' g) z
- ! h ]' l* `7 t8 ~; q
- callLibrary(j, "listAccess", Tablefile);" d. a6 A$ T4 V% I$ D
- 2 ~$ x, f! s4 M3 S$ w- u% T
- print "Unloading: ", freeLibrary(j);
& R& f% X% Q7 k* V9 B - end;
: }7 I: ?7 [& [0 i, [8 ] - end;+ B' }' p0 K* K3 z; `6 P2 q7 {
复制代码 |