[TRNSYS-users] creating new type with freeware fortran compiler g95

Frank Giese f.giese at solitem.de
Mon Jun 2 06:20:46 PDT 2008


keilholz, werner schrieb:
> Dear Frank,
> 
> In principle, your approach should work (I agree with a previous post saying that the type number should not be 151 to avoid conflicts with existing components; Numbers > 200 should be fine).
> 
> A good way to check if your Dll is generated correctly is to use a dependency walker. You can get a free one at 
> http://www.dependencywalker.com/
> 
> This tool allows listing the functions provided by the DLL. It should show one with the name of your type (e.g. TYPE201), with the following attributes:
> 1. E^= C
> 2. Ordinal = 1, Hint = 0 (shouldn't really matter if it is different)
> 3. Function = TYPE201
> 
> 4. Entry point = some number
> 
> If the function does not show up at all, you should make sure it is exported. If 1. is not "C", you should look up how to change the "calling conventions" to "C" in the manual of your compiler. 
> 
> Hope this helps,
> 
> Werner 
> 
> 
> 
> -----Message d'origine-----
> De : Frank Giese [mailto:f.giese at solitem.de] 
> Envoyé : jeudi 29 mai 2008 08:17
> À : trnsys-users at engr.wisc.edu
> Objet : [TRNSYS-users] creating new type with freeware fortran compiler g95
> 
> Hello!
> I tried to create a new module by dropping a .dll file into the
> .../UserLib/ReleaseDLLs but it didn't work so far:
> Simulation Studio had following error messages:
> 
> TRNSYS Message 199 : TRNSYS found at least one user DLL in the UserLib
> directory. (Note: Only DLL's including Types that are used in the
> simulation are loaded)
> Reported information  : 0 user DLLs were loaded
> after searching in "D:\Programme\Trnsys16_1\UserLib\ReleaseDLLs"
> 
> So, TRNSYS found the .dll file but didn't load it up and I don't know why.
> 
> How I created the .dll file:
> -Precompiling my fortran file (type151.for) including the files: 
> TrnsysConstants.f90, TrnsysFunctions.f90, TrnsysData.f90, 
> typeck.for,messages.f90, linkck.f90.
> -I had problems with the messages.f90 file, because of the command "use 
> kernel 32". Since it is only for message purpose I deleted this command 
> line including the call 
> RaiseException(EXCEPTION_NONCONTINUABLE_EXCEPTION, 0, 0, 0). After this, 
> there was no problem.
> - Compiling the .dll file with the following command line:
> g95 -shared -mrtd -o type151.dll type151.for TrnsysConstants.o 
> TrnsysFunctions.o TrnsysData.o typeck.o messages.o linkck.o
> - Copying this file to the .../UserLib/ReleaseDLLs and starting 
> Simulation Studio with the type 151
> 
> My questions:
> -Doesn't it work due to the way I created the .dll? or
> -Doesn't it work due to some path missing in another file (TRNDLL.lib)?
> -Did anybody else figure it out how it works with a free compiler such 
> as watcom or g95?
> 
> Thank you in advance,
> Frank Giese
> 
> 
> 
> 
> 
Dear Werner,
thank you very much for your reply. With the dependency walker I figured 
out the problem: My compiler added an underscore to the type201 
function, so trnsys wasn't able to read it. I found the command from my 
compiler (-fno-underscoring) to suppress the underscoring and after 
recompiling everything worked fine.
So, thanks again,
Frank

-- 
Frank Giese

SOLITEM GmbH
Süsterfeldstraße 83
52072 Aachen
Germany
phone +49 (0)241 980 906-0
fax   +49 (0)241 980 906-30
www.solitem.de
f.giese at solitem.de

***************************************************************************
Besuchen Sie uns auf der INTERSOLAR vom 12.-14. Juni 2008 in München
(Halle C1, Stand 519).
Visit us at INTERSOLAR in Munich from June 12-14, 2008 (hall C1, booth 519).
***************************************************************************

Geschäftsführer: Dr.-Ing. Ahmet Lokurlu
Sitz der Gesellschaft: 52072 Aachen
Amtsgericht Registergericht Aachen HRB 7865
USt-Id-Nr.: DE200074034





More information about the TRNSYS-users mailing list