- is% l& h ?# y F. \1 _
- r:real; file:string;
8 S% H9 t' L3 v' { - do
) ]$ F, g2 V$ a! \* v. _$ r& |) I - openConsole;' h( j$ [" c* s H
; o3 T6 H) \3 c+ }, |4 {. w- A- /*
R) A2 n- v/ x: {' c6 C$ g - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",8 g. L/ `$ b, G/ f+ @. w
- when is64BitApplication then 64 else 32,
+ L8 \5 G; |1 b) o6 S& E3 c - "bit.dll");
6 P/ E+ n$ o- B! a- c, f; E - */' Y, C+ N1 m- L9 T, g
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";# h, n, S( k4 Y5 k( R
- local j := loadLibrary(file);
/ w, v9 r0 Z4 z! U! c p
$ u# h; f! e/ [3 U" ~* {# [- if j > 0 then( R3 G, m% Q$ C( z0 [3 p* J; g
- print getLoadedLibrary(j)," is loaded.";
2 W+ V1 O- ?# N! ]2 p8 a
4 `) I! \# c) [/ g- r := callLibrary(j, "calcSin", PI/6);
1 M9 Y- }' q" {1 {% v - promptmessage(to_str("sin(PI/6) = ", r));
) A% ^9 H4 z& j, q9 r -
5 U. u+ S# d* P% Y+ n - local str:string;% I! X. a- s) r( l% I- \8 U" O
- str := "I'm OK!";
! V' R5 N8 n: `* N; A8 I$ |5 { - str := callLibrary(j,"resetStr",str);
( K4 g5 \1 Z' P: p: f& l - promptmessage(str);, z3 ~, D& ^, g& \& R
- * `. n4 v- N$ o) S
- callLibrary(j, "listAccess", Tablefile);1 A! B" U* J$ X w! P/ z, p8 `7 b
-
& c1 I& x C8 L B# f - print "Unloading: ", freeLibrary(j);7 B( d; d' |: y
- end;( K% [ t( H0 H
- end;
* ~9 \/ L! L. m0 g
复制代码 |