- is& _# Z' `4 ], Z+ n
- r:real; file:string;3 g; z, I! |# ^. t
- do
' r! _1 v6 p m) j) r7 Y4 p4 B; r - openConsole;8 k- ]3 R/ q% b7 z# b1 J
- S/ t3 @3 U& m8 Q- /*
6 `" l3 U) z% o: {# X% g2 N - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
' N" q+ H+ Q4 p6 j- b - when is64BitApplication then 64 else 32,
. Q! J7 m: E& u/ w t& |6 ?* w - "bit.dll");
3 e1 [- y0 G+ E! D! |& u - */
) i9 t% A- s7 w; g: l - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll"; M: R5 {3 h* Q8 G3 }# `) j
- local j := loadLibrary(file);
) \% p$ S! e! J. j - & b& m# n8 d1 L: s# }% ]/ k
- if j > 0 then6 A' ?$ Y0 P2 w4 z
- print getLoadedLibrary(j)," is loaded.";
9 p V- E( j) C% m0 b+ N8 o5 w: ?+ p: | - 4 l( M! N/ R3 {! \+ C- r+ g! H( P3 o0 l& Z
- r := callLibrary(j, "calcSin", PI/6);
* Z' M M! C# `1 w - promptmessage(to_str("sin(PI/6) = ", r));1 n2 G3 q( a* c% o3 u
- * W- S5 k) u+ |
- local str:string;* y5 P9 o- h- b
- str := "I'm OK!";8 h! V( R" Q1 @
- str := callLibrary(j,"resetStr",str);9 ~/ K% J6 }# u1 n' W
- promptmessage(str);
6 V, W9 w: q) J, f - & Q- Q5 Y' H3 A
- callLibrary(j, "listAccess", Tablefile);* b3 p# Y0 F- j# n/ g& w4 j
- & x! y3 ^7 ^% y1 m
- print "Unloading: ", freeLibrary(j);% e2 _/ C+ G8 y# O$ j
- end;
* Y0 s0 L( u, m4 m, a' b0 X. m - end;
! \" J) e# A: e) v% X4 ^/ L# j1 ?
复制代码 |