- is( t. j/ @- w" C% B2 } p
- r:real; file:string;
6 v1 m [# Z4 _' x) Y$ w* b+ d- J! ] - do
- q9 T& v, p+ c4 H i& s - openConsole;+ `- g( o* a* W( c5 M. w
- $ t! ^2 H# W; x! |# B$ g! m" h
- /*
# x# J1 ]& M2 {3 P, l; h9 F! e4 _" K4 P) v - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
9 k7 Y- b) Z' |+ j1 s0 q - when is64BitApplication then 64 else 32,
. G* E5 G, q! P/ R - "bit.dll");/ O$ D% R3 t' p* b
- */% T- V" G# p* w" |8 q m3 W
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";6 X4 M' k5 ?/ F3 ~7 R8 H: C9 V
- local j := loadLibrary(file);
- A' g' D5 ~, @' L
2 a- J' A& J Z* N7 o c9 n* ?- if j > 0 then
: @. e4 @6 g9 R; @' D! Z$ G - print getLoadedLibrary(j)," is loaded.";
* ]5 S2 E2 z0 |* N* n0 z+ B1 s
/ D- W5 @1 Z1 V7 Z3 Z4 i; Z" X- r := callLibrary(j, "calcSin", PI/6);
& O# r# l! [2 `' b5 E: F5 B - promptmessage(to_str("sin(PI/6) = ", r));; ?2 q3 u" f! x+ j# a0 }
-
9 L9 t8 X* k; C% X - local str:string;2 c& b3 [' i- s* v4 ]0 ~# I" {# v
- str := "I'm OK!";
% m# v. L% d2 p3 X5 I' I - str := callLibrary(j,"resetStr",str);
- [7 X5 S, A' y& _5 E - promptmessage(str);8 G2 v# o7 }& p/ t' |8 N! o% R) r
-
, t* f- w5 ]' ^) s& X - callLibrary(j, "listAccess", Tablefile);
/ N) s4 U' f% }& W - 0 w4 N' L+ M: T; Q1 @/ n* M
- print "Unloading: ", freeLibrary(j);$ D, a0 y7 l( Q/ N1 ]6 g2 j6 R
- end;
. k" t5 j2 X- T" z! M1 a2 A7 e$ O8 ? - end;, f7 S) {) O- C1 T
复制代码 |