- is" x% x& J. u' H# ]* ?
- r:real; file:string;
) R c+ I! G& p, ` - do! x1 S: U" y, a8 N9 R
- openConsole;
6 k4 v* X' d- T
( B+ D, X3 C' @# `9 P- /*8 e; L4 O. Q/ I; ~: j
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",7 U* o( k/ n8 O4 R. U9 K/ O
- when is64BitApplication then 64 else 32,
( I0 s+ D0 y$ ] - "bit.dll");+ ?& B( C5 M( s) K( D1 e
- */, n/ W' v6 G% Q( d7 t) C
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
3 o& [- o- [1 v - local j := loadLibrary(file);
" s. n! E5 z8 `" i5 N
3 l7 u/ V3 U/ i% F( z2 n. J1 A2 P- if j > 0 then
1 s! E3 h+ t# ?, e g9 y! I - print getLoadedLibrary(j)," is loaded.";
, \& b/ Y5 L) G' I+ N7 U2 n( _ - 9 a x) ^" d: G0 C$ Z- P$ |
- r := callLibrary(j, "calcSin", PI/6);" b( T" C6 V1 a' l7 J! A5 q! G
- promptmessage(to_str("sin(PI/6) = ", r));+ n$ ~7 f E3 J9 U" E" v
-
1 R9 R/ A4 c, N$ ` - local str:string;% c0 Z5 y1 L3 a- B6 o3 q
- str := "I'm OK!";
Y8 C% M# i& p7 Q* M. ~) Z4 W - str := callLibrary(j,"resetStr",str);; u, x0 f8 h# ]4 X% A
- promptmessage(str);
2 Q" Y! @% c- Z. g# J! o5 r - $ v( `# X' w* u9 J: W8 B7 w
- callLibrary(j, "listAccess", Tablefile);
* C+ Z* X2 S R - ; k4 p5 P; l8 G: f
- print "Unloading: ", freeLibrary(j);
9 ~! h c( e! ? P! z' \! c; A - end;
# o, W# [/ i! w* D, L - end; W- J) u# S: R
复制代码 |