- is8 w% N; h7 S: c: I* d
- r:real; file:string;
& `$ x3 Z! i2 L+ ~: E - do o, w' v3 F' s, l9 k. t& i" c
- openConsole;: x7 T2 U' N$ O Z' C
, t d8 {, ?5 }& j0 I- /*$ F" g( }* L! f) l
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",6 N% }" Q# K, R; X' \' O
- when is64BitApplication then 64 else 32,2 f$ r9 p0 H v$ M
- "bit.dll");
, c6 ~# e- S" q2 D+ @ - */
* A: o: t8 _! z$ P& | - file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";
7 o4 H7 v& z/ S p - local j := loadLibrary(file);$ h+ z( G7 a+ R5 S/ U
0 q D% X- M2 M5 V' P- if j > 0 then
& b& a( I* ^* S9 z* T+ ] - print getLoadedLibrary(j)," is loaded.";
- D1 Q: V2 P' z! e - & _4 k" F/ P& y9 o3 R
- r := callLibrary(j, "calcSin", PI/6);
) T- V, @/ j @# `) ^ - promptmessage(to_str("sin(PI/6) = ", r));
- t- i) I! C5 p: }1 T2 H ^ - + N# L1 f D6 x
- local str:string;+ T$ p/ p6 J; m
- str := "I'm OK!";
. F, m9 ?/ x3 q. K7 \: @4 c9 i9 w& V - str := callLibrary(j,"resetStr",str);6 P2 e c7 d7 x$ [
- promptmessage(str);
5 r$ x; J j; Z i& d( T - * m" @9 Z5 ~$ U8 g8 {! w
- callLibrary(j, "listAccess", Tablefile);2 y2 C* |4 {9 f
-
. ]4 ~ D3 b+ C, t, E. k5 G3 ~ - print "Unloading: ", freeLibrary(j);
9 C4 Z5 C% o6 ?7 y0 ~ - end;
9 H% B$ b: g$ P% M* z( j6 S. [# ^ - end;
2 T) r% U0 N& E8 e2 B5 V% C
复制代码 |