<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.5890" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN
class=767200723-12012010>Hi,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=767200723-12012010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=767200723-12012010>I have read some
posts on passing file names or labels to C++ TRNSYS types but I don't think this
question has been definitively answered.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=767200723-12012010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=767200723-12012010>This is what I have
done:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=767200723-12012010></SPAN></FONT> </DIV>
<DIV><SPAN class=767200723-12012010><FONT face=Arial size=2><SPAN
class=543463923-07012010>In the TRNSYS.h file I have the following lines which
map the fortran functions to C:</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff><FONT color=#0000ff>
<P><FONT face=Arial color=#000000 size=2>extern "C" __declspec(dllimport) char*
_cdecl TRNSYSFUNCTIONS_mp_GETLUFILENAME(int* LU);<BR>extern "C"
__declspec(dllimport) char* _cdecl TRNSYSFUNCTIONS_mp_GETLABEL(int*,
int*);<BR>#define getLUfilename TRNSYSFUNCTIONS_mp_GETLUFILENAME<BR>#define
getLabel TRNSYSFUNCTIONS_mp_GETLABEL </FONT></FONT></FONT></P>
<P><FONT face=Arial size=2><SPAN class=543463923-07012010>Then in the type
I have:</SPAN></FONT></P></SPAN></DIV><SPAN class=543463923-07012010><FONT
color=#0000ff><FONT color=#0000ff>
<P><FONT color=#000000 size=2></FONT><FONT face=Arial color=#000000 size=2>char
*ss, *ss2; <BR>int LU=(int) par[0]; <BR>int iu=info[0];<BR>int
num=1;<BR>ss=getLabel(&iu,&num);<BR>ss2=getLUfilename(&LU);<BR>FILE
*log; fopen_s(&log,"log.dat","w");<BR>fprintf(log,"\n%s\n%s",ss,ss2);
fclose(log);</FONT></FONT></FONT></P>
<P><FONT face=Arial></FONT></P>
<DIV><FONT face=Arial><FONT size=2>This code works (doesn't crash) but
prints<SPAN class=543463923-07012010> to the<SPAN class=767200723-12012010> log
file:</SPAN></SPAN></FONT></FONT></DIV></SPAN>
<DIV><SPAN class=543463923-07012010><FONT face=Arial><FONT size=2><SPAN
class=767200723-12012010>"</SPAN>Label not available"
</FONT></FONT></SPAN></DIV>
<DIV><SPAN class=543463923-07012010><FONT face=Arial size=2>"Cannot find a
file associated with that logical unit"</FONT></SPAN></DIV>
<DIV><SPAN class=543463923-07012010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=543463923-07012010><FONT face=Arial size=2>I did link the
file, logical unit and labels correctly in the proforma so that is not the
problem.</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=767200723-12012010>Does anyone know
what I am doing wrong?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=767200723-12012010>Thanks,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=767200723-12012010></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=767200723-12012010>Mark</SPAN></FONT></DIV></BODY></HTML>