- is
! h8 Z. B, ]1 y; j& G - r:real; file:string;, D8 d$ u9 t; e8 M5 [
- do6 y K; S4 C/ y% b. f
- openConsole;9 @' s, d2 Z7 [% S& L
8 W `' _* U7 o- /*0 o) S7 d3 [4 `0 x
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
4 D, c1 {, Z; l0 i9 z! r# C; d - when is64BitApplication then 64 else 32,
! ]$ G( r& Y R& \6 b# g# m - "bit.dll");
' J: V" a& R P" p: h - */
1 K2 a0 S8 L7 c1 y - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
6 S6 G: v( t4 u9 a Q+ l - local j := loadLibrary(file);+ n6 T. i6 M8 Z
- ( c3 b& P; _2 P0 O( z
- if j > 0 then
5 K4 d# @# I6 k% Z! u- H# P5 j - print getLoadedLibrary(j)," is loaded.";" g4 o% ^" {8 e3 R+ \
- - S; ?. |4 u) g. q% t% F
- r := callLibrary(j, "calcSin", PI/6);
- U7 Q/ n. w# @4 g2 q - promptmessage(to_str("sin(PI/6) = ", r));; ]5 e$ {: v% S- f2 F. X, |
- 9 i) N9 b9 C8 r
- local str:string;
& ^& l* i! s0 l7 @8 G! b e - str := "I'm OK!";
) w* e5 v* Z8 k - str := callLibrary(j,"resetStr",str);
) A- ]$ x& F. N6 y. h - promptmessage(str);: B- W" ~# o# S H5 _: B# b
-
. ^( R% [; t! y! m - callLibrary(j, "listAccess", Tablefile);
6 L/ l) [0 {2 U9 S) ^: g -
' X. E: Q' Z# ? A: I7 Z - print "Unloading: ", freeLibrary(j);# A& D* f [8 v8 L1 ^
- end;
f. H) f' \7 ?- [9 T+ J2 H - end;
) p! v1 `; i1 \/ S. i* M) |- Y
复制代码 |