- is9 s. z( c/ q+ \% G
- r:real; file:string;5 u8 o$ s& e4 G# o' }) ]
- do
1 ?% c* s1 v( F. M - openConsole;2 c: {8 R: d6 \) h+ A$ @9 I/ L* g
- * x% C% G' X5 C1 p% r' o0 e- c. m
- /*3 ?4 R# P- ~/ t" D: \5 x
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
+ @: {1 m& ^# [1 m0 l0 X& J - when is64BitApplication then 64 else 32,( {8 @" b' C( l# e* K T/ a# ^
- "bit.dll");: A& |# z- k3 u2 M% N
- */$ A5 z; y! \* D: F# q, p4 b
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";; f# d. T/ c5 y
- local j := loadLibrary(file);
! P6 k+ j ?/ D! o7 e7 i1 @1 @# d# i
6 k2 i$ a1 ^1 ^: _) h/ j% R- if j > 0 then
, ^2 Q' _2 L; U8 B& ^: f8 b: e& D9 U - print getLoadedLibrary(j)," is loaded.";
0 K% I1 U. D5 B
$ ?) d7 g3 L1 X- _- r := callLibrary(j, "calcSin", PI/6);: D! p) K- H) t6 g- Y D2 ?9 P4 d
- promptmessage(to_str("sin(PI/6) = ", r));6 [2 V* s: v: F4 Y9 b
- 3 v% S9 S& F% U2 K, E9 w* F4 f
- local str:string;9 N- F H# S8 x0 k) f
- str := "I'm OK!";
# t) G* N2 g6 |1 M - str := callLibrary(j,"resetStr",str);
% K: E$ c9 P% o3 M7 Q; [, { - promptmessage(str);, ^ w1 W% ?: y; H
-
2 M" E, }5 m5 \ - callLibrary(j, "listAccess", Tablefile);2 [5 o9 D# C7 c: \6 F: ]3 ?* E
- # O4 e1 i- r6 m7 D5 I1 A9 R9 ?* \
- print "Unloading: ", freeLibrary(j);/ G' p Z: P" i; Z
- end;
/ S( ]: Z" L7 f, I5 X! `1 e - end;- A6 b$ a3 r) y$ j9 b/ L; c2 R
复制代码 |