- is
. H! N; }: ?8 _$ E2 ~ - r:real; file:string;$ x3 N1 M, s \
- do
# w4 J& u0 p' ^9 G( R- ~ - openConsole;6 q1 a5 ]3 V9 i- b
- 5 C5 F% g% m- y' E/ b7 Q z
- /*
7 X8 G7 z& X: P# n0 H7 Y } - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
# `9 n. h9 [! `1 j9 n$ W \) O - when is64BitApplication then 64 else 32,1 D8 A: A# R6 i# v% {
- "bit.dll");( I- a4 H5 @9 K9 r& |4 z
- */3 ~8 g2 T" q* P* l/ W! u
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";* |7 a0 E+ p8 g+ Q; t! B
- local j := loadLibrary(file);( e$ J% j4 [, N: B/ y; t
- 0 M$ j' N( t" u& W- n8 l; [) _
- if j > 0 then
: B% v' r( M8 _8 d - print getLoadedLibrary(j)," is loaded.";
2 z6 j- w2 C2 P: m; v6 y$ e
& m' f# l; E9 y; c6 w' v" I |! t$ l- r := callLibrary(j, "calcSin", PI/6);
! H# w4 v) u! M3 r/ r8 @$ x - promptmessage(to_str("sin(PI/6) = ", r));
: o1 S# o' j8 u, R9 _ - , Y2 i- y' P+ S$ H! j, ]( R
- local str:string;
: {$ O' W2 {; d - str := "I'm OK!";! K# i8 r4 S" @# `' C3 Z8 U
- str := callLibrary(j,"resetStr",str);1 t: M: I* H9 c7 [# d3 K( e& n
- promptmessage(str);
5 a6 T, e( H6 L' p, X# R" H - 9 S, Y6 \3 g, K
- callLibrary(j, "listAccess", Tablefile);$ z' Z2 q1 B7 S- \5 f% E8 q8 Q
- ; l: ?) O0 i9 h( @
- print "Unloading: ", freeLibrary(j);6 ^6 t5 Z- f" J9 H( e V9 `' |
- end;
V0 C0 `: p3 J2 { - end; V4 R. ?* h n
复制代码 |