- is# X& A U" Q" S/ `) g" R
- r:real; file:string;2 `+ i( z% T# t% l/ o# p
- do
" |" }' E. b3 J9 y7 H3 q8 T" Z/ g - openConsole;
4 D3 O' N9 e! F9 o* [8 B) Z - 7 f# l( W8 s/ `2 c$ A/ L$ u
- /*
, o! n' @7 [' Y - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",( g7 j5 V7 E* |; m+ W" F& _
- when is64BitApplication then 64 else 32,
% Q7 h! {% \1 H" `7 x' s - "bit.dll");
9 ^. Q! p$ U K( g% ^ - */
9 ^. N& s) ]: ^8 N! f( [ - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
7 ~3 [0 m& r, P$ k - local j := loadLibrary(file);
" k4 a: u K& e - 3 ^8 e+ V, k9 R4 y$ x" \
- if j > 0 then
0 \) z. O" ?2 d& c# |/ p - print getLoadedLibrary(j)," is loaded.";
: w: I: J' i! o4 q
5 w: ~7 Z+ X/ v$ z( v: t) P4 v# G- r := callLibrary(j, "calcSin", PI/6);
: k0 `# P' u. z3 ] - promptmessage(to_str("sin(PI/6) = ", r));0 G3 n& @+ y1 P7 K, t* k
- - S. b6 y2 A, J2 n7 P
- local str:string;8 f( T. V4 _) a8 s& i2 W. S
- str := "I'm OK!";% C( ~$ o+ G8 |8 F
- str := callLibrary(j,"resetStr",str);
- A$ D4 d1 B" s4 S& ^8 }0 B - promptmessage(str);; F9 X0 O& _- {) s! b
- 3 a- l% K& V& L
- callLibrary(j, "listAccess", Tablefile);$ C& A: _. ^: u9 [2 l. {
-
( E" q! u9 P# M - print "Unloading: ", freeLibrary(j);0 I: P! O1 I' k0 h- G
- end;
" \; E) ?* _% K3 P2 o; Q# F - end;
1 S1 ~+ {1 p1 R. O5 X# f, c
复制代码 |