[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: external DLL component



Eduardo, 
 
Actually, you don't need the .LIB file.
The DLL you create in Delphi should be as follows:
- The File name/path must be \Trnsys15\ExtDLL.dll
- Variables should be declared with EXACTLY the same type as the Fortran example (and the same order)
- Export the correct function name (EXTDLL)
 
The code here below comes from an example that Sandy Klein gave me. It works for me, whether or not ExtDLL.lib is there. A simple IISiBat project using this DLL (or the default Fortran one) is also attached.
 
Delphi code (To be included in a "DLL" project named "ExtDLLP"):

library EXTDLLP;
{$D+,L+}

uses
   SysUtils,
   Classes;

type
   chr280=array[0..280] of char;
   realarray100=array[1..100] of single;
   realarray4=array[1..4] of single;
   double100=array[1..100] of double;
   integer15=array[1..15] of integer;

procedure EXTDLL(var Spass:chr280; var SArrayPass:realarray100; var
SimArray:realArray4;
    var XIn:double100; var XOut:double100; var T,DTDT:realarray100; var
Par:realarray100; var Info:integer15;
    var ICtrl:integer15);  export; stdcall;
  begin
    XOut[1]:=XIn[1]+XIn[2];
    SPass:='This should work';
  end; {EXTDLL}

  exports
    EXTDLL;

begin
   ;{no initiation code needed}
end. 

Good luck,

Michaël

_________________________________________________________

Michaël Kummert

Solar Energy Laboratory - University of Wisconsin-Madison
1303 Engr Res Bldg, 1500 Engineering Drive
Madison, WI 53706

Tel: +1 (608) 263-1589
Fax: +1 (608) 262-8464
E-mail: kummert@sel.me.wisc.edu

SEL Web Site: http://sel.me.wisc.edu
TRNSYS Web Site: http://sel.me.wisc.edu/trnsys

Attachment: ExtDLLPr.zip
Description: Zip compressed data