- is
' j, O' J$ j" @% ^6 b - r:real; file:string;; W$ W" V$ C8 }
- do! u4 d- M0 }9 l$ F7 ~
- openConsole;6 @" N/ ^- n" _ c, i7 h
- / M; n0 |( _* _; }4 E, C
- /** z* Q: c5 ?* c' F! h" ]: z
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
0 r1 x5 N- j( c; l; s+ R6 Y% d - when is64BitApplication then 64 else 32,
- L3 l8 ~) N0 ~( ~ - "bit.dll");/ d; S B. }# {: [" z4 `) z6 S( U) g' p
- */
# n* ~# a$ `- S - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
% L ^; n+ o$ E8 l2 U9 E2 J" b3 A - local j := loadLibrary(file);
+ c- d4 } ^7 P - 4 x0 |2 L4 m, }, g* U4 v" r" u
- if j > 0 then
7 g0 J& Z% _& E+ ~4 M" s- \# D# {) E$ _ - print getLoadedLibrary(j)," is loaded.";0 L+ L& _# ?5 Z! N
& a- f3 j1 Z" L. E H+ B- r := callLibrary(j, "calcSin", PI/6);
' ]* {* t; T5 M( P3 Y. b) G - promptmessage(to_str("sin(PI/6) = ", r));
8 C. s% b$ ?8 i% Z6 R9 L8 ^9 i - 6 E* Z% B( X- K! e
- local str:string;; z7 C) E. J$ t$ O0 _9 ?
- str := "I'm OK!";
p7 {# I8 }; V# H! M' S - str := callLibrary(j,"resetStr",str);% p" V! F0 B# f
- promptmessage(str);
: [, A. B. U( L1 e0 I* n& \/ y5 ] -
4 o o1 G, D+ p - callLibrary(j, "listAccess", Tablefile);1 K5 G6 @- ^5 S/ x, _; s" E K) ^
- 2 Q) |* [; v* R0 g* J" e
- print "Unloading: ", freeLibrary(j);
" T' F; j5 M5 E0 e - end;
' A: W+ \8 k% T - end;, w0 q/ O4 B! D1 a: E- i
复制代码 |