- is; [0 l/ O8 c. N7 i3 O7 @/ x
- r:real; file:string;# i% U/ c9 x* C0 S
- do( s4 ~2 I/ G5 N5 B( }- `
- openConsole;
% h" [/ W& c6 j1 i - $ p; z% E( A0 `: t7 D6 m
- /*
* q$ G5 L, n, m2 X0 n# N - file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",. |2 F! y% O- |
- when is64BitApplication then 64 else 32,
" @+ Y3 p% V# t7 r/ L% l0 P0 H - "bit.dll");
3 n; v( F2 q/ g, [0 R3 o' A: ~ - */
T+ N: i3 B5 y$ `* H) u; P' K - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
& J7 ]( k& Y( r, e' p" c+ y - local j := loadLibrary(file);' q! f7 ^7 D0 F2 D6 Q+ L
7 b- ?* b; ?3 }, M6 J/ Z- if j > 0 then
) e2 g+ T% _, N2 s% f - print getLoadedLibrary(j)," is loaded.";1 Y! W. Q* m5 g% \, e
- 0 q8 G% c) A" t6 o6 r
- r := callLibrary(j, "calcSin", PI/6);
$ d: ?6 V/ L. l f - promptmessage(to_str("sin(PI/6) = ", r));
0 e# I4 w9 I3 j' Z1 [ -
2 ] f* a. ]9 B - local str:string;
Z1 ^4 T2 }; O. k7 Y - str := "I'm OK!";8 g* W F0 `$ k7 q& g$ I& y8 _
- str := callLibrary(j,"resetStr",str);
/ g6 i/ a8 D6 ? - promptmessage(str);$ Z0 w' R+ p% {8 E* k+ S
- 1 g8 l, b" W6 C9 O5 n; x
- callLibrary(j, "listAccess", Tablefile);! Y/ Q. v" ~0 l4 v5 V# N! M* Q
- ) M) c& l4 p. D4 X) c: F4 _
- print "Unloading: ", freeLibrary(j);" G9 l' K' M7 e' s1 M3 p
- end;% d1 Y5 t7 C. c2 ^- s/ i6 e# S" e7 C
- end;
2 t, N$ a- k! c, [/ D# g. V
复制代码 |