- is! K+ Z8 a. i q% m/ d/ @
- r:real; file:string;
$ e- ]# k" ]1 b9 | - do$ K; M. S9 S) w3 n* \- c
- openConsole;3 A3 Z7 ^! X( {/ h8 c
- ( y8 W/ i9 i9 Y- g1 a5 R
- /*
: l; ]9 X+ y" P. w# P2 O - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
* e/ H; G2 q- ~$ t) a0 H - when is64BitApplication then 64 else 32,7 }1 [$ m+ j% b2 C, [
- "bit.dll");" @2 T1 l: h& J6 {0 n
- */
. W% m0 ^3 R" O* n/ L3 c7 W - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";/ x' z, {& z, \; y* ~
- local j := loadLibrary(file);: x: k7 W6 m* R; f" Q
: @' ~6 t+ |# i% |- y7 C% R- if j > 0 then
* I% A( A4 A" n z - print getLoadedLibrary(j)," is loaded.";
( B, ^. Y. n, ?1 A! `
" A. ?* }% g6 g' D/ h* E! E+ r& e2 n8 w- r := callLibrary(j, "calcSin", PI/6);
6 B+ ?7 g: f; e - promptmessage(to_str("sin(PI/6) = ", r));
2 g, `' j5 l* _/ E! k( A - ( r/ {/ k2 w, m. _- K2 N8 m% I b- i( ]
- local str:string;& R4 F; Y4 R3 F& x
- str := "I'm OK!";# P0 C( G3 z* Z% L, _
- str := callLibrary(j,"resetStr",str);
& O; }& ]- v; {; x; F" w - promptmessage(str);1 N/ ~3 Q9 N/ D( ~
-
7 q+ a: l! `, e T. d) G - callLibrary(j, "listAccess", Tablefile);4 i. w$ d7 N, ^# V
-
1 q a" {9 J/ A% {( D1 j# Q - print "Unloading: ", freeLibrary(j);. q8 M Y9 ~- f/ d
- end;
' e% j& [6 g: n$ }# u* [- E - end;+ y# j7 D# a7 }7 S1 \
复制代码 |