- is* s/ {0 p$ H' ]; u6 Z
- r:real; file:string;- ~! N' Z# E/ N8 M' ?
- do
- o' S; C! P+ b. `; l1 Z4 e - openConsole;8 j/ k8 Y( k% j( @, y
0 n' R! o* H( r( g1 c9 K; P- /*5 N# y4 [# W7 y0 j5 Y
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
! r6 e# ~1 P7 L& O: I/ j - when is64BitApplication then 64 else 32,
; t# b9 T( L9 {; B L4 D. m1 C - "bit.dll");
0 F& t5 b- D( v" V+ V - */" J+ b' v8 ^. D% L; z% Q' f2 N5 P$ {, ^
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
# i/ L' h q* u( t6 `3 [ - local j := loadLibrary(file);
3 Z8 V- `5 F1 d1 b6 P! y
/ W, a6 C8 _# I: H- W/ u X5 b- if j > 0 then% A+ Y* X( j* S: t9 ?! J. a' n
- print getLoadedLibrary(j)," is loaded.";
+ H. H) u: N: G, c- u - # E5 t& Y: ~7 ^& d" |2 g3 g
- r := callLibrary(j, "calcSin", PI/6);
+ o& K6 m& X- O, _6 K8 J - promptmessage(to_str("sin(PI/6) = ", r));$ {8 z$ z" s; l& O* e$ _( ?1 G* ]
-
1 m. T; y& `1 ] M* c( \ - local str:string;
' ?; f' G# m. P2 B0 P6 Y* ` - str := "I'm OK!";
* {# y! `! A* l; `3 O/ y3 ^0 Z+ } - str := callLibrary(j,"resetStr",str);
; h2 o" G& w6 A' b - promptmessage(str);
$ c" b' _, ~+ c -
) u/ i7 m4 _6 [+ C7 D - callLibrary(j, "listAccess", Tablefile);
3 s; a9 C. v1 @ -
4 D7 n% W5 F& C8 v6 P - print "Unloading: ", freeLibrary(j);- p1 R4 t$ \9 p, M- g# M
- end;9 S `4 P# r% b+ a& N
- end;2 a5 I9 i! n; w: F) _
复制代码 |