- is3 _2 u/ @' p L9 T2 {. H5 s$ A
- r:real; file:string;
: X! T0 n3 Q2 k; B! B - do. H% b! O9 A( Z' `
- openConsole;" ]/ f- z: d' O3 F' r! R7 Y
% B) U, ]: k' o$ ?4 f5 {- /*
& X Z# Z% B* r7 h; c - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",: Y; A; K8 A1 C& x- H
- when is64BitApplication then 64 else 32,
/ f7 ~6 c) ^: N L9 u6 i - "bit.dll");, q0 ^3 k: x% M6 P! }
- */. @. }+ b ^7 u' m4 |
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
/ N6 X3 R: d6 F( V! B, w+ [9 @: t - local j := loadLibrary(file);% g- o# f' G0 H" b2 ]: v, r# g1 C
- ! ~) i- T5 }" x9 V* T
- if j > 0 then
+ U' [- B$ N3 O; v! ~8 C - print getLoadedLibrary(j)," is loaded.";
7 G0 a# ^! R) p$ b - ' x3 N# a# g* o6 A
- r := callLibrary(j, "calcSin", PI/6);0 g) ]0 t( F4 h% M! G g
- promptmessage(to_str("sin(PI/6) = ", r));, s+ l0 `+ L' h& `/ F( @# Z
- 9 g+ A5 m4 i) q$ {# p
- local str:string;5 w1 a) i, A: Z3 Q* c
- str := "I'm OK!";6 f8 X9 ?2 Z' I8 s" i" n
- str := callLibrary(j,"resetStr",str);2 }) o8 z8 `3 i7 A
- promptmessage(str);
( g, q5 Y3 m# J4 ~1 Q -
$ c" p$ B! ?$ @ - callLibrary(j, "listAccess", Tablefile);# I$ O* v$ k8 B0 Y7 M* R- H1 o! h
-
! G( ~: _3 E; } x$ J; | - print "Unloading: ", freeLibrary(j);# l( f" k) B$ X2 R) e W2 _) O% {
- end;) @9 j. n1 N6 t% ^ Z9 F- p. |
- end;/ M9 n7 D- G. N, `( I
复制代码 |