[TRNSYS-users] Writing to external files with TYPES defined inexternal DLLs

Todd Houstein toddh at utas.edu.au
Wed Feb 2 19:16:40 PST 2005


Fixed! Thanks Michaël.

- Todd

-----Original Message-----
From: trnsys-users-bounces at engr.wisc.edu
[mailto:trnsys-users-bounces at engr.wisc.edu]On Behalf Of Michaël Kummert
Sent: Wednesday, 2 February 2005 17:24
To: trnsys-users at engr.wisc.edu
Subject: Re: [TRNSYS-users] Writing to external files with TYPES defined
inexternal DLLs


Todd,

> I am trying to write to an external file in a TYPE that I am developing. I
> am using TRNSYS16 and CVF6.6, and am building the TYPE in an external DLL.
I
> have been able to write to any external file except for the UNIT's
assigned
> external file (as specified by the ASSIGN statement in the TRNSYS deck
> file).

This looks very much like the problem that was described by another user
(INQUIRE statement fails). Here is my answer again:

SHARING LOGICAL UNITS (FILES) BETWEEN DLL'S

Typical symptoms:
You assign a file in the TRNSYS input file and that file seems to be
inaccessible to user-Types compiled in an external DLL.
- An "Inquire" statement tells you that the Logical Unit is not
associated to a file
- Attempts to write to / read from the file create "fort.nnn" (where nnn
is the logical unit)

Solution:
If a TRNSYS Type uses a file that is opened and closed by the kernel
(i.e. a file managed through an "ASSIGN" statement in the deck, or an
"External File" in a Studio proforma), the logical unit is associated to
the actual file in TRNDll. If a Type that accesses the file is compiled
into a separate DLL in UserLib:
- Both DLL's must be linked to the DLL form of the Fortran run-time
libraries. Use "/libs:dll" in the command line, or set "Project
Settings\Fortran\Libraries" to "Single-threaded DLL" in the Visual
Studio ("Debug Single-threaded DLL" for debug configuration).
- Furthermore, all DLL's must be compiled in the same mode (Debug or
Release). Note that by default TRNSYS is shipped with a Release
TRNDll.dll, but a Debug DLL is available in "\Compilers\Cvf66\TRNDll\Debug".

Please let us know if this fixes your problem.

Michaël Kummert



--
_________________________________________________________

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 at engr.wisc.edu

SEL Web Site: http://sel.me.wisc.edu
TRNSYS Web Site: http://sel.me.wisc.edu/trnsys
_______________________________________________
TRNSYS-users mailing list
TRNSYS-users at engr.wisc.edu
https://www.cae.wisc.edu/mailman/listinfo/trnsys-users




More information about the TRNSYS-users mailing list