[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: external DLL component
- Date: Thu, 31 Oct 2002 14:03:59 +0100
- Date: Thu, 31 Oct 2002 07:01:01 -0600
- From: "Eduardo Castro CETHIL" <eduardo@xxxxxxxxxxxxxxxx>
- Subject: Re: external DLL component
Thanks Michaël,
NOW IT WORKS!
In fact, I noted that the exports directive should be followed by the word EXTDLL (in uppercase letters). I've tried words like ExtDLL or extdll and they don't work...
Well, thanks again,
Eduardo
----- Original Message -----
From: Michaël Kummert
To: trnsys@relay.doit.wisc.edu
Sent: Wednesday, October 30, 2002 10:43 PM
Subject: 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