- is
- L) ]6 P* v [6 M# n7 k; X! ` - r:real; file:string;
/ g& b8 ]# O v: [- M/ |; f - do4 @& v* v* h* U9 c
- openConsole;# P& \, L1 T/ `6 n* P0 ~. ~
% M$ d- {4 V5 K8 b9 P- /*! a3 a' z4 ?. S- y. z0 }/ ?
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
& l4 k. w! q1 s6 p; V - when is64BitApplication then 64 else 32,
/ d5 J3 g Q; Q5 ?" a6 U - "bit.dll");
/ q8 Y9 d ~) ~1 B3 ~ - *// A5 E: f5 d) \' w( f
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
3 Q* l6 n3 p9 v. L3 e( r - local j := loadLibrary(file);; ?* I' X# o9 U3 B. D: F! v
5 X9 L5 f5 n" V& x, i- if j > 0 then
; B# D" L) R& ~ - print getLoadedLibrary(j)," is loaded.";5 G" O- H8 w' v. V: K
* p/ D* ~, s9 K, y" c% V1 }8 v- r := callLibrary(j, "calcSin", PI/6);
2 I+ K) ?& g5 A: u$ q/ [8 F - promptmessage(to_str("sin(PI/6) = ", r));
- J8 N5 r- B H# y& P! `. M5 w' c$ \: G -
1 N/ x; i2 f u4 ?1 \5 s - local str:string;
0 f: X& P6 M. t; |. x( G1 T - str := "I'm OK!";% Y2 ?( a }: j8 \, b
- str := callLibrary(j,"resetStr",str);% X1 T8 I. ?' F0 {# q% V
- promptmessage(str);
8 L3 E( X% ~' {/ a Q4 w- B" ~ - " ^3 B% B- y, d* [# H3 O
- callLibrary(j, "listAccess", Tablefile);
- n* B3 \# i. u% Z/ K" S - 8 _! ]# u; x. T* w; Q9 N
- print "Unloading: ", freeLibrary(j);6 q9 V2 w* t( t7 J. B- k
- end;
. e% b& Q: N1 e* q - end;
' b* j( {& @" U; F9 G, g9 v7 g
复制代码 |