- is
7 r j6 E, v1 S& K9 B4 s7 A - r:real; file:string;
% G% V& \' L+ @$ ?% I+ L7 C - do
* X7 ]# z5 e0 m. i - openConsole;: |5 j; r5 N2 b5 ^: p0 ^& P
- 2 u. i: K/ ?, Q* j1 {& }( `" B
- /* R! {. B4 ?6 e4 w3 C+ F9 w3 L
- file := to_str(ApplicationHome, "\Plant Simulation\C-Interface\cinterf",; `% {* @ |8 t( I% ]! t; t& W
- when is64BitApplication then 64 else 32,) f/ ^; i2 q( A
- "bit.dll");) v% A2 z1 r' v7 H* e
- */$ K) y* i' }! e: N# K
- file := "C:\Users\sun\Documents\Visual Studio 2010\Projects\sg64dll\x64\Debug\sg64dll.dll";- h6 J- R5 b# `( g5 s+ I
- local j := loadLibrary(file);6 G' X$ o9 k3 w8 G4 R8 @+ @5 c
; q& H' J' q" c/ t- `( j) d- if j > 0 then6 ?, b* e2 Q, ?8 C" `4 Z
- print getLoadedLibrary(j)," is loaded.";
9 P1 H w9 p5 K1 z3 G' E/ r
/ H9 b7 J. T G" v- r := callLibrary(j, "calcSin", PI/6);
) A' V+ M5 y9 e - promptmessage(to_str("sin(PI/6) = ", r));- K' u* i1 J. `2 x+ v7 z7 n
-
) o* \# r, f' b( i( _1 g - local str:string;
$ V( j4 l! s$ E, ^9 T" v& y- W - str := "I'm OK!";5 ^8 o, Z0 M. a3 a! u. t
- str := callLibrary(j,"resetStr",str);
& v s2 q2 K5 b( i- ~0 v" _ D# y - promptmessage(str);7 e6 G" z, l$ ? H; Y B& |, M) V- g
- - C9 \4 W. Y" U8 x
- callLibrary(j, "listAccess", Tablefile);
! `5 F. l$ q) f. H4 u -
3 ?) @/ G4 _+ E) Y0 B - print "Unloading: ", freeLibrary(j);) Q3 [8 _- O5 N( ?* J
- end;
G5 l5 [1 F' w% z# ` - end;
7 g" p }* _! z) J
复制代码 |