- is
, ~: I( i0 N4 W - r:real; file:string;
: v0 J6 b* c6 E: R$ P% L/ h - do, z' v) O3 X* Y! z* ?$ L
- openConsole;$ Q# F( r. I% x( x- W
7 M3 K; [) Q3 M( y# A* h- /*" w* @. [* U7 c' A- I% q5 C3 L# I
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",5 b1 ]. r1 V$ n I1 d
- when is64BitApplication then 64 else 32,
# s Y: T! ~0 s% q4 k! ^; ^ - "bit.dll");: I9 X0 C7 T+ P7 F% D, {1 E
- */$ m( u; w4 s' g6 n( E
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";3 h8 o$ ` \7 m
- local j := loadLibrary(file);; Z# [. E" |, V# \( {
" J2 [ [9 `0 |2 i: C: r- if j > 0 then
% i/ N+ c& h. l6 q( Z - print getLoadedLibrary(j)," is loaded.";
' l) c6 n# j" n- ?7 e3 E - % B3 i# p4 r, V
- r := callLibrary(j, "calcSin", PI/6);
5 [) F+ F) n! C$ w D# Q; K! _ - promptmessage(to_str("sin(PI/6) = ", r));
' ?2 C- ]) X* s( y% ~& Z) f5 q -
6 i4 e6 B" b. \. ^. Z4 b% c% y6 i - local str:string;' S/ u/ z. ]9 M- e. L
- str := "I'm OK!";
. n/ X) B6 k; V7 N$ } - str := callLibrary(j,"resetStr",str);! J- Y* [5 ^2 y2 [
- promptmessage(str);
8 q! p' \1 z6 o" b) b - 7 E4 ?: }* R0 A, g; t7 H" K
- callLibrary(j, "listAccess", Tablefile);$ s. T1 p. p6 ^4 z6 a* k
-
% q. W0 {: \8 T% [, @" \0 V - print "Unloading: ", freeLibrary(j);
+ b2 k& m, Z ~4 v* M* W - end;
1 R( w$ f% m% a! B8 z$ e8 n7 t - end;
$ R0 J4 `; a* m
复制代码 |