- is
" |3 U/ \& X$ @. |7 |* z - r:real; file:string;
# j4 W o, i! d2 g0 o$ D - do
) z% V) l1 e8 n6 o* k: d - openConsole;& m, U& t: ~, M
$ V! r' x5 j! z1 x0 W- /** I) q5 q# h3 A. Z( d& \
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",, F: J4 V3 @0 ?& X A4 l% m+ m
- when is64BitApplication then 64 else 32,( K0 ^$ X7 F( L. a$ W8 U
- "bit.dll");3 Y5 O2 g% d7 s' p
- */
8 n6 W/ ~1 F7 }# f - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
5 P$ L0 o& [: O( ~. c6 p - local j := loadLibrary(file);
; ]5 E8 v7 X" P - 1 i/ y5 j. L- Q5 p( F2 M
- if j > 0 then6 l. |& z( |. W" T( i6 p. i
- print getLoadedLibrary(j)," is loaded.";2 [" j2 W) S e; Z
- ) _. ~ b& \4 U
- r := callLibrary(j, "calcSin", PI/6);3 L9 S* r/ q: i+ ]+ r
- promptmessage(to_str("sin(PI/6) = ", r));
. z8 T; [6 g2 S" R+ {0 _% M -
7 T w" W3 t) T8 L - local str:string;
% X' r7 ]& L% R5 A - str := "I'm OK!";
5 z# I* } y! X6 M - str := callLibrary(j,"resetStr",str);& C7 X V- Q5 v% l
- promptmessage(str);
7 p# R. ^ h" S5 X/ x# C - % N6 ?& @# W3 u/ D& r x
- callLibrary(j, "listAccess", Tablefile);
% F# _. L9 ?( h( a( f6 b -
1 }) X. Z* n M! t8 I" X" G; p - print "Unloading: ", freeLibrary(j);6 R, f; E& Q4 @3 D. A4 A5 _
- end;
- `3 L/ f2 e" Z1 b" t' ]1 \ - end;
2 ~. A& N! [4 j$ ?' ^6 Y9 i
复制代码 |