- is# A2 J, z2 T' ]
- r:real; file:string;! d7 V8 n9 K# Q) R
- do, Z6 g5 G/ y$ R' m
- openConsole;
$ _& v9 `* |, Z! h# X, y& p& z \, N
+ A0 Z! h* ]! x& c0 B) V- /*
+ h% R/ V" v" r0 T - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
H+ m7 L+ D$ u% r; V* V( h - when is64BitApplication then 64 else 32,/ k' m2 P/ f2 @+ d5 X4 [
- "bit.dll");
$ Q# J( Z' q7 u# z/ c- _7 R - */
. W" c* v g, i' k- D - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";( R9 ~/ S* @4 a+ w" |
- local j := loadLibrary(file);
& `8 {- w" J) f J - 8 d3 K6 i+ `; x0 u/ i6 ?/ `* C$ s% x
- if j > 0 then
- m. T3 R3 {& h# q K - print getLoadedLibrary(j)," is loaded.";
" A2 Z3 n* \) o3 h
x0 G' |+ g7 l9 P4 F* p- r := callLibrary(j, "calcSin", PI/6);5 |$ X- B4 U j- K1 s4 i, n
- promptmessage(to_str("sin(PI/6) = ", r));7 q3 y/ p# W9 E# i/ M, w2 }
- 2 Z1 M6 j0 @& g0 L2 L
- local str:string;1 H4 T4 F: m( D1 o
- str := "I'm OK!";
4 b5 J5 y4 l7 I - str := callLibrary(j,"resetStr",str);
c4 h ?% O3 k# @5 y v2 T% Y - promptmessage(str);$ m! H) h' i2 n" ~9 L1 `' o8 ]
-
0 \$ f j; p s/ [( @ - callLibrary(j, "listAccess", Tablefile);
& ^" {/ P7 h/ M, p# h% d9 I. S9 V - 2 @6 A1 X, ~/ ?4 ?- q( R
- print "Unloading: ", freeLibrary(j);* J/ J( s" l$ `# `% Q. V0 O
- end;, M3 r1 N$ ^% W4 T |
- end;$ A$ X* T9 k& ]5 E6 @# X; F
复制代码 |