[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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@dwa.nl]
Envoyé : jeudi 19 juillet 2007 11:34
À : trnsys-users@engr.wisc.e
du
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.
************************************************************************************