- is5 J" ~# T E$ `1 p7 D9 M) `
- r:real; file:string;# f, k# o5 ^5 z* R2 B2 W& X3 @
- do
7 [. I' I7 c/ n& P' T# `0 Q! j - openConsole;
! w6 ^- _# }* S - - D d( E8 Y1 x6 R, B7 m0 z
- /*+ D- F! ~- r: e [* x! A
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",6 `8 R# w z3 e. v. v" R' q. e6 _
- when is64BitApplication then 64 else 32,* H( g8 s s+ U+ ~1 p4 B e% _
- "bit.dll");1 @; C7 b9 T7 F
- */% ^3 M( k3 a! B9 r& L2 V) M E V+ E
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
. ]* S7 ?+ x z7 K7 o - local j := loadLibrary(file);3 M, N# M p( n' l
+ s% A& `$ |- P9 M$ j' W4 r- if j > 0 then0 f m$ u( c; {, r3 `
- print getLoadedLibrary(j)," is loaded.";
9 L" L9 |% z$ a9 i& ?- }! O - $ K! F/ [$ l1 a1 ]
- r := callLibrary(j, "calcSin", PI/6);
( B' W' F& K3 s6 T* X' i. J - promptmessage(to_str("sin(PI/6) = ", r));- J) i' Z" Z, S! e
-
7 g3 |# s, N) ~5 ] - local str:string;3 ?# V+ H; L) K4 l7 ], G m* z% W9 }
- str := "I'm OK!";
% Z6 ^5 B5 i7 Q+ Q - str := callLibrary(j,"resetStr",str);
# r; G l2 s% ~8 W- T1 o - promptmessage(str);
/ J; g1 N) u R" H2 R5 N4 _ -
2 W7 t% g! X k8 G+ m I( \ - callLibrary(j, "listAccess", Tablefile);8 w; H6 d% h: p* Y7 m
-
, I) [1 x0 c( z$ ^3 `2 e, J/ H - print "Unloading: ", freeLibrary(j);
6 y0 U! A% `$ s$ W0 q - end;
3 l) L3 w" W3 f4 ~9 y, Q2 z$ w - end;
- A' g. Y+ `: [. c- Y
复制代码 |