- is' O0 b/ a4 h. f# {; M1 v
- r:real; file:string;
& d; K7 _3 T$ K: v7 `/ |* T - do
6 Z: F) I! F* c P - openConsole;
+ J: B3 k: c# |1 e% R
. o' P3 l. J9 K- `+ N6 p* {' u- /*
6 z9 W5 |1 [8 Y) }2 t - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",! o: q w" |: Q
- when is64BitApplication then 64 else 32,
. ^- e a5 ]( f$ \8 B, b - "bit.dll");! I. T' R f+ O1 i
- */
b- ]! G7 A! c: N3 o* Z - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";1 K( ~/ R6 B8 @+ n# @' I/ s$ `& e
- local j := loadLibrary(file);
! A: B! v! R2 ~. _" I }
! D# r5 k+ e& D- if j > 0 then; @2 d; u$ X" L; y7 f' ]2 e+ _$ U- L
- print getLoadedLibrary(j)," is loaded.";
4 p- a8 O* a! j! U - / N' n0 p3 L) L( |! A
- r := callLibrary(j, "calcSin", PI/6);
. y0 I2 a3 q- M - promptmessage(to_str("sin(PI/6) = ", r));
) Z: g: J% R1 N* A$ o7 n# A6 z -
/ |2 w# i6 C* s* O+ \& L - local str:string;% U8 t/ k- }5 S
- str := "I'm OK!";
" ? A, N: b$ Y( E- {, v - str := callLibrary(j,"resetStr",str);. ^, J2 g# h1 ?
- promptmessage(str);
, P P B1 _. U" ^ - " y. J6 C, r4 o/ p
- callLibrary(j, "listAccess", Tablefile);9 E% K3 @. R* D& j4 I$ Q% B
- " v6 E: h) e7 E7 z. _9 e
- print "Unloading: ", freeLibrary(j);
) O% A- k8 T0 Q) i8 h - end;9 z' ^5 D, b0 e
- end;0 c% H" Y0 j( H6 c' r1 P
复制代码 |