- is6 M3 J" D6 s2 z& _
- r:real; file:string;
. v. R% U5 k6 ^6 {7 f% Q# R - do
" D, i- h# f3 O% D - openConsole;
. Q- N9 C! r* i! G
$ D. |% A. ~% {- @7 b9 `: O, j2 {0 f- /*' G+ `. Z/ i* a5 x5 `% x
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",( r) r" k; X" ?) _! a. o$ B6 g# }7 ^" E
- when is64BitApplication then 64 else 32,: m* v" F; h* t$ K
- "bit.dll");
9 S" v9 b( ]' W; L - */
3 X$ q2 o/ f: o: f2 R - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";( d& i }7 i E& b9 }5 M
- local j := loadLibrary(file);
- s) Z& i3 r$ y, B8 F - # D: Q6 d9 m" J8 J8 F) d+ Z2 \
- if j > 0 then
% A( L% I( Q+ X O# d; R - print getLoadedLibrary(j)," is loaded.";
1 b' n; o# ~; q( c9 Y
6 V) W# z" m% |( i$ s- r := callLibrary(j, "calcSin", PI/6);: r( l6 y. t! ]. P# \1 T4 m/ \
- promptmessage(to_str("sin(PI/6) = ", r));
" H5 W! M0 a- b/ [" p6 Q, c$ K - $ D* X/ q4 ^9 G& H& R) _# U
- local str:string;6 |& `2 H4 ?* _+ ^
- str := "I'm OK!";
' o9 M# J& u3 p3 \" l - str := callLibrary(j,"resetStr",str);
# r% S0 }+ r3 D) m" Z V - promptmessage(str);
7 T8 O0 }8 W, Y7 c) {3 Y2 U - ( U! _& P( a1 | |. x* n: M% b9 Q
- callLibrary(j, "listAccess", Tablefile);
# O( v7 T8 t, B5 Y -
. F- p5 o) Y: v7 _3 R0 H - print "Unloading: ", freeLibrary(j);( a* J3 U* [2 Z5 [, I6 v A( N
- end;7 n8 s7 i, c" K) E
- end;3 ^5 W- W) q0 t* T+ ?1 o/ C- |
复制代码 |