[TRNSYS-users] Betr.: C++ dll for new components

Henk Stijnen Stijnen at dwa.nl
Tue Jul 24 23:21:23 PDT 2007


Yes, I did! The problem is the generating of _ (underscore) beofre the
function name. So in the lib there is the function _type201. Solution is
very simple: use option __stdcall.
So: 
extern"C" __declspec(dllexport) __stdcall
Cheers
Henk

>>> "Uwe Meinhold" <uwe.meinhold at tu-dresden.de> 24-7-2007 19:27 >>>
Hi Henk 
 
I tried the same you did .... with the same result. Have you found a
way of usage the Borland compiler ??
 
thanks Uwe

Von: keilholz, werner [mailto:werner.keilholz at cstb.fr] 
Gesendet: Donnerstag, 19. Juli 2007 14:01
An: Henk Stijnen; trnsys-users at engr.wisc.edu 
Betreff: Re: [TRNSYS-users] C++ dll for new components


Hi Henk, 
Basically it shouldn’t matter what tool you use to create the DLL. The
problem can be on two levels:
Either the function implementing the type is not exported in the DLL,
or TRNSYS doesn’t recognize it. 
To check the first, simply use a tool like the dependency walker to
look at your DLL (Microsoft gives one away for free – type depends.exe
in google to find it). A correct DLL should show a C-style function
called “TYPE201” (with a little little grey “C” in the line that lists
it). If it isn’t there, you have trouble telling your compiler to export
the function. In the Microsoft world, one way to say this is the line 
extern"C" __declspec(dllexport)
generated by the Studio. It may have a different equivalent in your
world (including compiler directives and/or options). 
To check the second, make sure your type returns 1 at every possible
exit point. If it’s a complicated one, try a simple one first (like one
saying only “ return 1;”  ).
Hope this helps,
Werner
 


De :Henk Stijnen [mailto:Stijnen at dwa.nl] 
Envoyé : jeudi 19 juillet 2007 11:34
À : trnsys-users at engr.wisc.edu
Objet : [TRNSYS-users] C++ dll for new components

 

Hi all,

I'm trying to implement a new component (Type 201) in C++ following the
sectio 9.1 from the "Getting Started" manual. I've made the cpp via the
wizard, compiled the dll and placed it in
%Trnsys16_1%\UserLib\ReleaseDLLs.

 

Now the simulation gives an error, can't find the component. The log
file shows the following:

*** Notice at time        :         0.000000
    Generated by Unit     : Not applicable or not available
    Generated by Type     : Not applicable or not available
    Message               : "Type201Lib.dll" was found but did not
contain any components from the input file.

What is at hand? Has anyone experience with implementing C++
components?

 

Another problem is perhaps that I'm using Borland C++Builder, while the
wizard generates a makefile for VC. I've transformed the generated
makefile type201.dsp with a Borland tool vctobpr to a C++Builder project
and compiled it. Anyone using C++Builder?

 

Thanks for help

 

Henk




************************************************************************************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals &
computer viruses.
************************************************************************************






************************************************************************************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals &
computer viruses.
************************************************************************************


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/attachments/20070725/c953d10f/attachment-0001.htm>


More information about the TRNSYS-users mailing list