- is
$ i& z- e2 W( f - r:real; file:string;! S3 x5 g. y; j* V2 ]+ I
- do' M9 V/ M O" |/ p) @
- openConsole;
( q! V: D) }: X
: P7 |4 n9 k8 I- /*
$ B$ O3 ?$ T* y' K4 ] - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",( C* v+ z; T+ t+ X
- when is64BitApplication then 64 else 32,
( N% {) q$ p2 p - "bit.dll");
{9 I, `8 w4 A/ {% e' r - */5 H3 h$ \8 k1 \& j) i8 u/ ^* {
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
" S4 d" r. _; t! {& q& L/ f - local j := loadLibrary(file);
. [ N! n/ T) f$ R* ?! F: w" b- X - O# ~+ [0 H- `
- if j > 0 then- d+ }/ h: m9 F
- print getLoadedLibrary(j)," is loaded.";
4 W# |, Y0 E0 x4 S
1 R5 Y5 R5 i! e% n2 [% W- r := callLibrary(j, "calcSin", PI/6);
1 {- u' z' Q5 K: n- P1 r0 G' p9 ]8 x - promptmessage(to_str("sin(PI/6) = ", r));4 D; x& T Q) V* ?# l
-
1 h: }, X# r3 K - local str:string;, U* S2 ^3 ]0 Z9 d8 f* u
- str := "I'm OK!";& U' q+ S, t8 O) l7 [8 N" f
- str := callLibrary(j,"resetStr",str);$ M- Q* h, d5 G l! Y
- promptmessage(str);1 X( N8 Z: g. ]5 b& Y
- 7 s* \* [& j. X! A' F$ `1 h
- callLibrary(j, "listAccess", Tablefile);
. G& i# \) q" T# D4 x7 h( X& s -
; }. u, B" U% m* {3 G - print "Unloading: ", freeLibrary(j);
1 p+ j# O& V) b, S# `2 i3 h% i - end;% {- j/ W& h+ y& X6 M/ q' l
- end;
5 `9 U$ g+ g4 e7 Y8 [# `; ^
复制代码 |