- is k: @3 b' Y. [( S- P" {
- r:real; file:string;+ U1 _0 X- F! x6 E/ j" t. o( k0 u
- do
1 ~# S3 t2 T0 k% t" I/ `/ N7 j - openConsole;$ w. |; B9 k/ M: h- o5 s( R% o1 g; c
! e+ a: v8 K" E" G- /*9 o5 Q+ a% W1 f g
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",- I/ [* F+ ^9 v8 `2 q
- when is64BitApplication then 64 else 32,
9 P* ~/ l, i. T1 Z - "bit.dll");
( C4 y. i/ d) c0 L4 z+ ~. j - */5 a1 s# I) R4 i+ `! T
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";! r4 n' h j8 c, h; J8 x) Z* {
- local j := loadLibrary(file);7 [* k, H4 d" p2 G- B
l! J5 @& @$ {' e9 [- if j > 0 then
5 | [! v; c, A- k% |& K7 G - print getLoadedLibrary(j)," is loaded.";! A0 d7 P/ k2 p$ l& h. O% [- G
5 L- Y' N! c L4 E8 ?. g$ c; [- r := callLibrary(j, "calcSin", PI/6);
0 e" K+ B2 L& H& j - promptmessage(to_str("sin(PI/6) = ", r));- C4 Q- o4 z( D- M) R
-
9 e+ v% l: f" u' u - local str:string;
: p& L/ _4 R& P! Y0 n( @- T/ n" W - str := "I'm OK!";4 E4 _( q9 B# g9 [
- str := callLibrary(j,"resetStr",str);6 j1 e1 O" F. U
- promptmessage(str);
# r" u. u# { B D+ w+ \# i -
3 l: r% R! B1 r4 G ~2 ~7 \ - callLibrary(j, "listAccess", Tablefile);" H0 T4 W# V6 e- e
- H: ]1 o* e+ \( D+ p5 Q: b
- print "Unloading: ", freeLibrary(j);' Y7 J. ^* O' f7 b. z& Y8 U X
- end;
. e2 |) M4 M T5 y) ?% E8 j - end;
: D$ C! r! }- L1 o
复制代码 |