- is
0 F1 R% M$ s8 l& b( w4 {. j) P - r:real; file:string;
% ]# Y3 z6 X- I/ F' M1 [" ?6 M' r - do
* w. R. i: h7 @ - openConsole;+ D3 x4 [& R8 I5 k8 X2 U
( N0 A8 Y8 M& Y- N# `- /*; u4 e. `* S9 E! V- }& b
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",7 d2 }7 z* P% f6 f, x4 N4 f
- when is64BitApplication then 64 else 32,
. E6 X0 r2 a5 V( z - "bit.dll");9 x4 P9 X. w( `. x% l0 c* U
- */0 x* p: }' f, [' c9 E2 P
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";9 y# M X5 s- \' x" _, l
- local j := loadLibrary(file); M# t+ A' R+ ?8 a
- ; R. @ T9 u" I& g
- if j > 0 then
( \1 d. M) n, M - print getLoadedLibrary(j)," is loaded.";
* c) ]) j9 P6 _4 U( f* O% `
' b2 b/ `0 U) K- r := callLibrary(j, "calcSin", PI/6);
( R) K8 Y3 A" d: v - promptmessage(to_str("sin(PI/6) = ", r));
7 a# Z+ t- f+ ?9 e! Q$ f -
" Y6 q# f; I& f8 d6 M - local str:string;
4 c2 y$ W# S- C* T' G+ a/ F: r - str := "I'm OK!";
2 \ `0 N4 O& v- D5 e! x+ v! P - str := callLibrary(j,"resetStr",str);
/ I! l( |3 e+ ] - promptmessage(str);2 ?0 @3 o8 A- c( J: {& z( _2 B
- : u" d( }$ l# c5 i, T
- callLibrary(j, "listAccess", Tablefile);/ F' J- L# B2 U; Z
-
; F2 [8 ]$ c, u. Z# ~" n6 Z - print "Unloading: ", freeLibrary(j);; K( {, s2 R* ^9 j. Z, E
- end;
- Q+ X! H. i1 }% n7 I. w - end;5 {5 e0 V+ D1 c
复制代码 |