- is
* F3 R/ d; L2 A. [" v' b - r:real; file:string;
2 ?" z7 f) {1 N, t2 ~. X0 | - do3 C( E) P" z- z4 c+ k" H
- openConsole;2 t1 L1 E/ p- |+ k
) R% k3 \* j* k# e6 _- /*
. |1 H6 X1 f% h4 U n5 j0 i7 j4 Z2 w. k - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",- t# N5 `6 W! ~7 \' @
- when is64BitApplication then 64 else 32,
, C! m, G# ]. P d+ h - "bit.dll");
2 [9 }) u7 }: p3 r2 q - */& f0 k' X0 X& ^9 \/ M* P4 s
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";8 {/ Z* s2 {. I% S% O a
- local j := loadLibrary(file);
1 w5 W) `" z/ V8 b
7 G1 X- N: E5 X9 ~- if j > 0 then
( f" }' k2 q! T' B. U/ l - print getLoadedLibrary(j)," is loaded.";
# [8 L7 l& t$ {" F- @ H7 V/ V
8 z6 Q$ T( P& C% h% W- r := callLibrary(j, "calcSin", PI/6);
+ a+ {% |2 ?0 \' \; m: Y - promptmessage(to_str("sin(PI/6) = ", r));
( K& `8 E; [# M - ' e+ N" h [0 b/ y$ _4 Z
- local str:string;0 d% F0 ]/ V2 ^8 e% K5 a/ k; o
- str := "I'm OK!";/ l7 V5 ^ m2 l, B! Q
- str := callLibrary(j,"resetStr",str);
. \8 ^5 `! O; w - promptmessage(str);
' c3 \) O/ K1 e( J" ] -
' N9 _; R2 I/ ~+ o2 n: A/ t4 w - callLibrary(j, "listAccess", Tablefile);
% i5 m) w9 u3 l }6 d - # P4 b1 p% D: H" u
- print "Unloading: ", freeLibrary(j);
7 t Y8 f$ u$ ]" C/ b- E9 N - end;9 Q W% P& }- o( S" G! `1 h! f
- end;
( `0 `% L) J7 j5 n7 v9 o
复制代码 |