- is
N: P: u* e( A, P8 A8 X - r:real; file:string;$ A( o$ M0 l. h0 q
- do
$ P9 s8 i2 t9 X6 d, i# v - openConsole;3 D1 [3 m7 E' i+ J$ G! X; H
2 [2 e- i! u; i4 A- /*( c! f- ]. y8 l& c/ \
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",% c6 s/ C+ s/ u" [1 ^. u
- when is64BitApplication then 64 else 32,
+ M @2 J) F' e! T - "bit.dll");4 q k! K) c: B/ ^- P7 `8 H4 }( f
- */
8 I& z: G6 x! F3 E - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
! W3 H$ J7 Z# ]5 \2 M0 N% V - local j := loadLibrary(file);
+ { e# |& @8 G5 m% i6 d4 o/ t - # Z" P0 A+ N9 P8 { D& K6 E
- if j > 0 then- z5 F; D' V2 c' ]
- print getLoadedLibrary(j)," is loaded."; ~' l! ]7 E9 V6 E2 ]
- ( S" \/ x& K) {% T7 {9 ]9 v
- r := callLibrary(j, "calcSin", PI/6);
) Y9 q; x, H8 r" `: n - promptmessage(to_str("sin(PI/6) = ", r));: E6 U4 u& g* O
- 7 \% f4 F4 {9 h) n/ A7 X
- local str:string;
3 }* f4 v+ I Y! M1 U- g ?) B4 ?7 p& a+ h3 q - str := "I'm OK!";
! h4 N; z% o* D2 L2 m* y0 Z0 v, N - str := callLibrary(j,"resetStr",str);: A9 ]0 A, E- S. A' n
- promptmessage(str);
1 V% @( Y& H6 T% m' g% b$ c" j -
! R. v5 R% q/ l - callLibrary(j, "listAccess", Tablefile);! C8 M }) C- [! L
-
$ |: w; k# `7 w9 | - print "Unloading: ", freeLibrary(j);
$ V1 a- x$ a# b# z' g0 N - end;6 o7 Y0 h% ?, A5 t9 k0 C! X
- end;6 A/ g4 K' e' l6 o% g0 r7 {
复制代码 |