<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.2900.3059" name=GENERATOR></HEAD>
<BODY style="MARGIN: 4px 4px 1px; FONT: 10pt Verdana">
<DIV>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.<BR></DIV>
<DIV>So: 
<P class=MsoNormal><FONT face="Courier New" color=blue size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">extern</SPAN></FONT><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <FONT color=#a31515><SPAN style="COLOR: #a31515">"C"</SPAN></FONT> <FONT color=blue><SPAN style="COLOR: blue">__declspec</SPAN></FONT>(<FONT color=blue><SPAN style="COLOR: blue">dllexport</SPAN></FONT>) __stdcall<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></FONT></P></DIV>
<DIV>Cheers</DIV>
<DIV>Henk</DIV>
<DIV><BR>>>> "Uwe Meinhold" <uwe.meinhold@tu-dresden.de> 24-7-2007 19:27 >>><BR></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN class=450461316-24072007>Hi Henk </SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN class=450461316-24072007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN class=450461316-24072007>I tried the same you did .... with the same result. Have you found a way of usage the Borland compiler ??</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN class=450461316-24072007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN class=450461316-24072007>thanks Uwe</SPAN></FONT></DIV><FONT face=Arial color=#0000ff size=2></FONT><BR>
<DIV class=OutlookMessageHeader lang=de dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>Von:</B> keilholz, werner [mailto:werner.keilholz@cstb.fr] <BR><B>Gesendet:</B> Donnerstag, 19. Juli 2007 14:01<BR><B>An:</B> Henk Stijnen; trnsys-users@engr.wisc.edu<BR><B>Betreff:</B> Re: [TRNSYS-users] C++ dll for new components<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=Section1>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Hi Henk, <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Basically it shouldn’t matter what tool you use to create the DLL. The problem can be on two levels:<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Either the function implementing the type is not exported in the DLL, or TRNSYS doesn’t recognize it. <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">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 <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=blue size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">extern</SPAN></FONT><FONT face="Courier New" size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <FONT color=#a31515><SPAN style="COLOR: #a31515">"C"</SPAN></FONT> <FONT color=blue><SPAN style="COLOR: blue">__declspec</SPAN></FONT>(<FONT color=blue><SPAN style="COLOR: blue">dllexport</SPAN></FONT>)<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">generated by the Studio. It may have a different equivalent in your world (including compiler directives and/or options). <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">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;”  ).<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Hope this helps,<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Werner<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<DIV style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: medium none; PADDING-LEFT: 4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: blue 1.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: medium none">
<DIV>
<DIV class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B><FONT face=Tahoma size=2><SPAN lang=EN-GB style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">De :</SPAN></FONT></B><FONT face=Tahoma size=2><SPAN lang=EN-GB style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"> Henk Stijnen [mailto:Stijnen@dwa.nl] <BR><B><SPAN style="FONT-WEIGHT: bold">Envoyé :</SPAN></B> jeudi 19 juillet 2007 11:34<BR><B><SPAN style="FONT-WEIGHT: bold">À :</SPAN></B> trnsys-users@engr.wisc.e</SPAN></FONT><FONT face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">du<BR><B><SPAN style="FONT-WEIGHT: bold">Objet :</SPAN></B> [TRNSYS-users] C++ dll for new components</SPAN></FONT><o:p></o:p></P></DIV>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Verdana size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">Hi all,<o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Verdana size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">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.<o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Verdana size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Verdana size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">Now the simulation gives an error, can't find the component. The log file shows the following:<o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Verdana size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">*** Notice at time        :         0.000000<BR>    Generated by Unit     : Not applicable or not available<BR>    Generated by Type     : Not applicable or not available<BR>    Message               : "Type201Lib.dll" was found but did not contain any components from the input file.<o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Verdana size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">What is at hand? Has anyone experience with implementing C++ components?<o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Verdana size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Verdana size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">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?<o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Verdana size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Verdana size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">Thanks for help<o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Verdana size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Verdana size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">Henk<o:p></o:p></SPAN></FONT></P></DIV></DIV></DIV><BR><BR><BR><BR>************************************************************************************<BR>This footnote confirms that this email message has been scanned by<BR>PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.<BR>************************************************************************************<BR><BR><BR><BR><BR><BR><BR>************************************************************************************<BR>This footnote confirms that this email message has been scanned by<BR>PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.<BR>************************************************************************************<BR><BR><BR></BODY></HTML>