[TRNSYS-users] User written type using external DLL

keilholz, werner werner.keilholz at cstb.fr
Wed Jun 1 00:24:54 PDT 2011


Hi Sven,

If it works when you remove the call to the DLL used by your TRNSYS type, the problem is probably that your type's DLL cannot find the second DLL (netcdf). 
Depending on how you code the call to the function in the library, the application will look for the DLL in the current directory, the directory of the type (RealeaseDlls or DebugDlls), or in the application startup directory \Trnsys17\Exe).

To be sure to catch the right spot, I construct an absolute path to the external DLL at runtime and feed that to the loadlibrary() function used by the type.

Werner

-----Message d'origine-----
De : trnsys-users-bounces at cae.wisc.edu [mailto:trnsys-users-bounces at cae.wisc.edu] De la part de Sven Böttcher
Envoyé : mardi 31 mai 2011 16:17
À : trnsys-users at cae.wisc.edu
Objet : [TRNSYS-users] User written type using external DLL

Hello everybody,

I want to write a TRNSYS type (Type203) which has to call a function of an
external DLL (netcdf). 
Therefore I have written a test type, which does nothing meaningful. It just
calls a function of the external DLL.

Compiling this type is not a problem, but simulation studio stops with the
following error:

*** Notice at time        :         0.000000
    Generated by Unit     : Not applicable or not available
    Generated by Type     : Not applicable or not available
    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
"C:\Trnsys17\UserLib\ReleaseDLLs"
 
*** Fatal Error at time   :         0.000000
    Generated by Unit     : Not applicable or not available
    Generated by Type     :   203
    TRNSYS Message    105 : A TYPE was called in the TRNSYS input file but
was either not linked into trndll.dll or was not found in an external dll. A
dummy subroutine was called in its place. Please link the TYPE or remove it
from the input file
    Reported information  :  Type203 could not be located in either the
trndll.dll or in an external dll. Please relink theTRNDll.dll including this
Type or make sure that an external DLL in the \UserLib\DebugDLLs and
\UserLib\ReleaseDLLs folders contain the Type.

, though the DLL of the Type (and the external DLL) is located in the
ReleaseDLLs directory.  Furthermore, if I comment the call to the external
DLL out, everything works fine.

Has anyone an idea how to use external DLLs in TRNSYS?

Thanks and best regards 
 Sven

---
Sven Böttcher
Diplom-Informatiker
Wissenschaftlicher Mitarbeiter

Technische Universität Dortmund
Fakultät Architektur und Bauingenieurwesen
Juniorprofessur Energieeffizientes Bauen

Baroper Straße 301
44227 Dortmund

Tel.: 0231 755 5248
Fax: 0231 755 5423

http://www.bauwesen.uni-dortmund.de/eeb/


_______________________________________________
TRNSYS-users mailing list
TRNSYS-users at cae.wisc.edu
https://mailman.cae.wisc.edu/listinfo/trnsys-users



More information about the TRNSYS-users mailing list