- is
3 R! `& [5 z Z! i6 ] - r:real; file:string;1 c3 N* J4 T6 o2 t' e' D% i
- do5 ^0 J! z, |0 _3 D; u
- openConsole;
4 p# X6 g) @0 b+ r8 Z/ }( t
C# |, Z+ ?4 W7 B! W a- /*& m% t* \, M- N/ M+ a2 r K- Q
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
9 v$ Y3 l- l- q' M0 W" i, ` - when is64BitApplication then 64 else 32," R! s1 a3 e) K& L- C) m
- "bit.dll");8 a% a. g0 U' X5 I0 P9 Y0 D
- */
. C! ?- B- K2 n4 w+ J. G7 {: i, [0 V6 n - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";) V, c6 v1 [' M
- local j := loadLibrary(file);
, A, z& d2 l( Q- X - 2 o2 l5 ^4 B3 S
- if j > 0 then
4 s. [1 t$ z |( k; x - print getLoadedLibrary(j)," is loaded.";
7 Z( M2 A! f6 L. l
$ [2 o/ D% `" `. A" W+ _3 j0 w- r := callLibrary(j, "calcSin", PI/6);% s8 @0 v0 _5 b9 V$ e |
- promptmessage(to_str("sin(PI/6) = ", r));
, z. U" ^9 b0 o# R - / y: U6 l, J3 q" D# U
- local str:string;( g t9 O- i( ]$ }$ O
- str := "I'm OK!";
& f, x; C5 R+ b- u - str := callLibrary(j,"resetStr",str);( Z7 c4 u% D7 y' ^+ y
- promptmessage(str);
1 x0 G4 m) C2 w -
y+ ? v Y- J - callLibrary(j, "listAccess", Tablefile);
& \/ o7 P% W) A" j( v/ \. w' x - 5 E$ B, m$ b Z' U/ g# ^& g* z
- print "Unloading: ", freeLibrary(j);
4 S+ A- D% l* e! ~* j) ^5 ?4 v ` - end;7 c% d) L4 d. M {4 X+ J8 X7 H
- end;
6 P9 b& W" H; W) { g3 K& e
复制代码 |