- is
# y8 G: b; A U+ M6 V - r:real; file:string;0 ]9 ~: r7 p) W6 d
- do# \8 G2 D, w7 i |# o1 c
- openConsole;+ M4 \/ M# Q p# B
- ) R3 V/ _& s! W! |- b
- /*4 k1 e6 h: ~ L" ~7 z& r/ g
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",
5 r& }: O7 t2 ] - when is64BitApplication then 64 else 32,
; z7 N) U: l2 a1 f6 A: M* A* w - "bit.dll");1 W* Q, p' I2 |2 v* M
- */' f6 j' ]7 j: x) x( J5 g- m
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
6 L; g: j+ p) D - local j := loadLibrary(file);
( C- e v' y3 L+ B
3 L0 h( ~2 Q3 `+ \. K8 U- if j > 0 then
2 r/ E! p0 O- E- E- \4 j1 k3 k - print getLoadedLibrary(j)," is loaded.";
7 X7 m& Y( h& ^8 [6 P - , ^8 o' J/ A- @4 [6 H5 Q- z7 c
- r := callLibrary(j, "calcSin", PI/6);4 I+ y5 x( m# F
- promptmessage(to_str("sin(PI/6) = ", r));
5 [1 q3 Z# F$ `& a+ }3 f# U - 3 z2 u4 I; Q/ o3 q4 n* R u
- local str:string;
) j1 p& ]" G" q% R2 |4 E - str := "I'm OK!";
# n& ~8 ~$ y* g7 I7 U% w - str := callLibrary(j,"resetStr",str);
- F2 p# E: J2 g+ C - promptmessage(str);
& M7 e9 P: ]! m* v1 z7 g -
" h' } @1 G% e [5 W# X - callLibrary(j, "listAccess", Tablefile);3 F5 Q/ h8 Y2 T# j& `% W% l- n. l4 z
-
( U2 j0 r8 |& c' X* T - print "Unloading: ", freeLibrary(j);2 O7 h7 Y+ h9 R- O; n+ Z0 d) o+ X
- end;+ s4 S2 O6 u$ f4 ^( ]' i. N. M- D
- end;2 \1 T0 Y: ~6 ]7 O
复制代码 |