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@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@cstb.fr] Gesendet: Donnerstag, 19. Juli 2007 14:01 An: Henk Stijnen; trnsys-users@engr.wisc.edu Betreff: Re: [TRNSYS-users] C++ dll for new components Hi Henk, Basically it shouldnt 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 doesnt 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 isnt 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 its 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] 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 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. ************************************************************************************ |