- is& q& C3 M1 I" M7 k( a+ o1 y1 |, [
- r:real; file:string;
6 T: }5 V: O- } |8 E2 m - do
1 ^, v" o; ~- c0 J - openConsole;, {6 z% Q0 u* T/ Z, V- _) l9 s
$ ~, C# a! T1 u" k7 z7 L- /*
' H. x( B0 S7 R t5 P4 v - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
8 r5 @% k( v% V- Q/ y8 ? - when is64BitApplication then 64 else 32,
2 {' a' {$ F4 Q' C, X - "bit.dll");
8 m6 Q$ K' o& y7 w% e8 c& x4 J7 E" e - */
' Z2 G) P$ {) W1 H: a! G& V, p) X - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";0 i9 \; L: g" E; U. j5 U
- local j := loadLibrary(file);1 ~' `9 j8 g N. H
' l: m# Y6 }: `8 p- f6 p- if j > 0 then
1 c; i" T4 i S1 y: @ - print getLoadedLibrary(j)," is loaded.";0 R+ W, X2 ]4 T$ h1 ^
- $ ~* {/ g& i: f, k8 _* [6 x
- r := callLibrary(j, "calcSin", PI/6);6 v9 |" V0 _* N- H0 {( M% a
- promptmessage(to_str("sin(PI/6) = ", r));7 U6 K% M6 ^% l# R
-
4 e4 S. K$ ^: u, l9 g! d - local str:string;. h' d0 @+ k. h
- str := "I'm OK!";2 A- i* N" c' [- I. W& ^1 V6 h
- str := callLibrary(j,"resetStr",str);
: l- h$ A) [2 M+ s2 Y - promptmessage(str);% |1 G8 p5 w/ f
-
) E9 B9 ]2 ]- | - callLibrary(j, "listAccess", Tablefile);
' Y: ~) O2 f/ m/ Z' R -
3 K: ]) c# h o$ o. D - print "Unloading: ", freeLibrary(j);1 t! V+ X2 U5 A0 w1 {; _' i
- end;
, B4 g+ p3 r2 N0 E) I - end;
) \( ]/ Z8 f6 x6 x/ X' V0 ^
复制代码 |