- is$ g! o9 L+ |# s. O Z# I
- r:real; file:string;
( p& e4 W! b0 ~* d; ], s$ Q4 e - do( E- M O# A8 V5 `2 E9 l
- openConsole;
/ z; X: a3 W. j& ^* q: P1 d& s7 k - ) B2 U! d1 d5 ]) Y5 V# d
- /*
# U3 X7 Z* ] L/ B2 l/ w0 i: g - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",+ Z$ f3 c; z) a" ]: c; I
- when is64BitApplication then 64 else 32,
4 a( v5 D4 W! E8 b8 J) X! E - "bit.dll");$ f J- D/ e* i# K: X9 y: _
- */
@& Q) D, a, y5 Z8 W - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
: q4 |' E' `1 \- n* w9 f - local j := loadLibrary(file);+ t* e c7 x- Y& y/ `% E
( S% h U! {& m8 L) u: }- if j > 0 then4 p" t/ q o1 d/ H
- print getLoadedLibrary(j)," is loaded.";
2 S" W) I, {& K
& k7 b+ a9 `# u1 c8 C- r := callLibrary(j, "calcSin", PI/6);
2 W1 X/ i& J5 W- @. h# ^! L! N0 W! d - promptmessage(to_str("sin(PI/6) = ", r));
0 z$ a( U, D/ o7 b& |( S -
X# q3 A1 O$ H8 y+ X - local str:string;
% f9 k$ i: g9 J: U, p - str := "I'm OK!";0 ~) A% \, r6 l% W
- str := callLibrary(j,"resetStr",str);* y. a F! x5 P. u; P+ `. _, }" R
- promptmessage(str);
1 T3 I2 l: _5 ]! p+ D -
! V4 l3 ?! x7 G( n7 M. ]' r - callLibrary(j, "listAccess", Tablefile);
. _$ [) v6 v6 z7 V -
0 W0 D' ?* Y4 F) v. O: t5 Y# G - print "Unloading: ", freeLibrary(j);+ d+ ^7 }# B0 ?) {; q
- end;
' ?8 _: f& A; a7 s& ~! g - end;
7 x: M# C0 u! @5 e- o. S
复制代码 |