- is
1 F1 b6 m) r# A/ ] - r:real; file:string;6 V$ }4 h+ {6 ]3 Y2 D# X
- do8 X7 M3 J& U3 o% _" H
- openConsole;% Z) s" B- t8 ^- O5 T1 l6 ]
- ' e( ^7 Y/ x. b" Q7 e; i! t
- /* i1 w0 v% ~) _! C3 y" r! t
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
' l9 G" j! A) ~" P# ?3 D; T - when is64BitApplication then 64 else 32,$ Z* F* }% N4 M4 a6 p/ O! Z) |' J
- "bit.dll");
& Z/ [5 f9 m- f/ K* R. x% m) z3 _ - */8 f! B A, l1 M- |' m
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
7 y, M. n, k, C, ] - local j := loadLibrary(file);( A% w/ d' }# ` w
- Q+ s1 z! }4 b& u6 I# ~0 d# o- if j > 0 then
6 s/ [% m s) U; ^2 @ - print getLoadedLibrary(j)," is loaded.";& b" L4 m0 I/ n5 X
- G8 f$ a' D) Z2 | S1 h- r := callLibrary(j, "calcSin", PI/6);
, E* q4 k f- E - promptmessage(to_str("sin(PI/6) = ", r));2 |) z7 p$ u( M* Z! N: h
- 4 C/ O! P! }- d
- local str:string;) q6 i% @; H4 `2 P
- str := "I'm OK!";" E" y$ V6 O& v+ g, j# d
- str := callLibrary(j,"resetStr",str);
; v+ F" g7 q" k. j4 `: W& w - promptmessage(str);
5 l" \2 c( o; A: v# ]6 `0 o - - ]1 y) I% {5 r/ [* O8 W
- callLibrary(j, "listAccess", Tablefile);( {7 A" }# |1 S) r# @9 s+ y
-
" P: b; O' z' R$ P - print "Unloading: ", freeLibrary(j);
. Z8 h9 E7 k( N& \' \9 _" l S - end;7 ~; d' A+ D$ Y% v1 a
- end;
1 W! V) x0 X8 X3 e7 Y
复制代码 |