- is$ f; P5 _6 J# d: |' X! b2 r; e% N
- r:real; file:string; v! s n+ t5 x5 ?
- do
* c: z3 Y, n+ ]2 x# c6 u5 c - openConsole;
8 s$ d& \, z& e+ Q3 e7 ^
3 h6 K$ z% [5 b2 o: c2 e- /*. U8 D. Z- W7 s
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",# Q+ B5 Q1 m7 _/ S' A
- when is64BitApplication then 64 else 32,$ W8 S: {1 ^3 Y; b
- "bit.dll");; h% ^6 z& g5 e% G8 k" D
- */
. }6 \7 N# _! a$ X) U( M% b - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";' I; Y; P6 }6 s! I3 A' Z9 _
- local j := loadLibrary(file);; L% r* z6 r' |7 W4 r$ s5 y! p
- 6 N Z0 G9 r8 L$ c
- if j > 0 then. z3 u$ a. A! n) W: ]% N% w j, x- |
- print getLoadedLibrary(j)," is loaded.";$ e$ \, I4 U. i9 b8 C
- 0 G$ V+ a& K6 ^8 A( I3 P4 M
- r := callLibrary(j, "calcSin", PI/6);' f$ N( A/ x! F8 `5 o P
- promptmessage(to_str("sin(PI/6) = ", r));
- L; J1 F+ B) o9 `6 z - , e+ N- ^9 d2 v) s8 [; j$ w/ C% e
- local str:string;- G2 {7 G' \- s: t3 `: w" l A
- str := "I'm OK!";/ [+ M* l" A& h# c$ e; c8 x/ r
- str := callLibrary(j,"resetStr",str);
( N+ p8 @9 l4 Z% D3 r- s - promptmessage(str);
8 v: o- P& G, s, K ^( T8 c) _ -
: Y O) r( ]+ x+ E9 C% }$ ?4 |4 X% _ - callLibrary(j, "listAccess", Tablefile);( S' r c& ^" {% I- f7 J
-
7 k( V- P7 V) k' A9 `* v - print "Unloading: ", freeLibrary(j);
~+ h3 D+ e) z( M - end;
# ^9 E g* @2 {6 G% V - end;
/ q% X& e# X7 d
复制代码 |