- is% z$ K ^, d& H% b: J' v
- r:real; file:string;' C! t" h$ a. U$ m
- do
+ }, [2 t% ?% h7 M( ?! U; L - openConsole;
0 V( R! T) i8 _- \) p+ O. c9 V
# N: i% e0 o7 R; C+ k( Z4 w- /*
5 y1 U3 [& }7 c) b2 u$ ] - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",7 j' L0 c8 m! b+ m, I
- when is64BitApplication then 64 else 32,
9 \( Q2 g* E; d4 A9 O y$ U9 \& I - "bit.dll");
: x3 L$ } n/ {9 O - */& N' Y. l2 D, x! ~
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
: h1 Y- y% x9 X1 p - local j := loadLibrary(file);
% j4 R+ }- J) b$ e: { - 7 o, h" Q$ `8 ?! n5 D" E6 {
- if j > 0 then
+ L1 C1 H" A$ |4 B& a - print getLoadedLibrary(j)," is loaded.";
9 d. w5 w s' }/ \( h- d- @. R" N. B
" w. D% w1 ~! x* E4 F) V+ R- r := callLibrary(j, "calcSin", PI/6);
) ^/ n2 o1 W' U( Z0 b* o; X n; g - promptmessage(to_str("sin(PI/6) = ", r));
& ?7 I; }0 D! ?& J9 U# n* R: J -
9 N0 a/ N x/ A { - local str:string;2 f# l3 U/ d) \" @& ~$ B8 V
- str := "I'm OK!";' Z% I( R' `( E5 d; _0 ~$ a! f. k5 N$ Z
- str := callLibrary(j,"resetStr",str);3 e9 K1 K# ?+ Z8 u% U9 U% S
- promptmessage(str);
8 q5 O; k0 }4 ?) m# d - " D4 n1 w H$ o9 o+ R" _
- callLibrary(j, "listAccess", Tablefile);
% X' H& J9 V- ~1 i - : o2 a( d( l! I
- print "Unloading: ", freeLibrary(j);; Y7 I- `; K' \. W# w
- end;
4 h3 I( @) f( X/ J. ^ O3 B - end;. D8 m0 N s* e6 a) B
复制代码 |