- is
) C% H/ W) u2 ?! A4 v+ C1 [" q - r:real; file:string;
+ G! w# n" G- D, g3 x - do; I3 l2 q+ d4 K$ L
- openConsole;' h1 ~+ z* h6 w0 V
' R' Y% ]' o$ \) K, @, \- /* |3 U4 L9 V. W. N
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
$ o1 G5 O L% G U4 w, a - when is64BitApplication then 64 else 32,8 a! T4 E9 W; [8 X( S8 p/ F% V
- "bit.dll");* ]3 E/ ?6 y0 h& U) S
- */0 M: m. s; y4 ^# b/ `8 q/ }3 I
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
! N+ A6 g9 v: d1 G - local j := loadLibrary(file);
3 z2 L ?3 k: k- Q
- \1 v" ?% Y# v) p( I$ S' C% @- if j > 0 then
0 K8 a- S; x* `+ _ - print getLoadedLibrary(j)," is loaded.";
9 H" D/ @7 c. Y0 J( X
! \' j) X. b9 R8 U3 n( m9 F- v4 y- r := callLibrary(j, "calcSin", PI/6);
1 N4 n( K; i1 d( | l4 N0 {& H - promptmessage(to_str("sin(PI/6) = ", r));
( _( |. T, I+ Z7 p -
& Y+ Q, Z8 g& L4 L - local str:string;
5 ?2 s2 B( p7 z4 y R - str := "I'm OK!";- i; K7 S/ F+ A7 \
- str := callLibrary(j,"resetStr",str);
. p# q8 A$ N) {7 f - promptmessage(str);7 j5 f2 w* Y' F1 Q; V, ?; Z
- % Y! W" B8 [( O& q* D' ~
- callLibrary(j, "listAccess", Tablefile);
- S$ S g: ~+ q b7 K -
6 N* {) c6 v1 o6 W" d. s - print "Unloading: ", freeLibrary(j);
6 a& Y2 t; p9 R* V2 S) J* y" V - end;/ c* L, L6 C+ V) N$ \. a
- end;
* Q6 D/ k8 }7 g' o$ t8 A
复制代码 |