- is
/ i4 T# j" e9 Y& ~: ]& P# s - r:real; file:string;& i8 Z! Z% W$ b4 F, F- l0 Y6 j
- do
6 w( ^& c- U& k2 e - openConsole;9 s, w) y. }/ N
- & _/ E9 R* w6 \8 d1 m
- /*; ^1 F# W' |2 i. G5 W
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
: I- G$ k) L) R) `; m, y - when is64BitApplication then 64 else 32,
! p$ q/ Y. M l8 m* v% n, T; X - "bit.dll");& C/ v, Y# F4 u0 B+ y
- */3 A/ @& u4 d' a/ j
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";0 ^3 S1 v5 M; N" s' ~
- local j := loadLibrary(file);- H8 ~+ j1 T$ U! b8 u8 j
- * |' Z+ o |: E( O) U1 p
- if j > 0 then
3 f. V; _/ H6 J8 \1 ^! f6 S - print getLoadedLibrary(j)," is loaded.";
: r- _5 N; Q* u- f( Y - & x1 A6 S, ?) J4 T5 J
- r := callLibrary(j, "calcSin", PI/6);
4 C# M; j! }- o) s. z - promptmessage(to_str("sin(PI/6) = ", r));
7 V6 r% t+ T( R! ]' g2 G9 y - . `9 F* Y% d6 U$ Q V) I4 V6 @) W
- local str:string;
/ |5 A: r. E L6 L. ]9 e - str := "I'm OK!";/ h! h) [6 m8 k
- str := callLibrary(j,"resetStr",str);" p M9 \8 ~* p+ V( t, {
- promptmessage(str);
9 R+ i. ]. y, j" r# O -
$ Z# {) [/ B+ u0 r. u7 S4 ]2 s - callLibrary(j, "listAccess", Tablefile);+ I) o0 N- s+ V8 B$ m$ Y
- 7 m# B1 T4 \7 b0 i3 t2 i) }6 g
- print "Unloading: ", freeLibrary(j);: b! P" T: t) @: L7 l G; n
- end;. X7 b) g/ f" }" `
- end;5 b; k" o) r/ }$ S
复制代码 |