[TRNSYS-users] C++ file names and labels in TRNSYS

Mark.Goldsworthy at csiro.au Mark.Goldsworthy at csiro.au
Tue Jan 12 15:17:17 PST 2010


Hi,

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.

This is what I have done:

In the TRNSYS.h file I have the following lines which map the fortran functions to C:

extern "C" __declspec(dllimport) char* _cdecl TRNSYSFUNCTIONS_mp_GETLUFILENAME(int* LU);
extern "C" __declspec(dllimport) char* _cdecl TRNSYSFUNCTIONS_mp_GETLABEL(int*, int*);
#define getLUfilename TRNSYSFUNCTIONS_mp_GETLUFILENAME
#define getLabel TRNSYSFUNCTIONS_mp_GETLABEL

Then in the type I have:

char *ss, *ss2;
int LU=(int) par[0];
int iu=info[0];
int num=1;
ss=getLabel(&iu,&num);
ss2=getLUfilename(&LU);
FILE *log; fopen_s(&log,"log.dat","w");
fprintf(log,"\n%s\n%s",ss,ss2); fclose(log);

This code works (doesn't crash) but prints to the log file:
"Label not available"
"Cannot find a file associated with that logical unit"

I did link the file, logical unit and labels correctly in the proforma so that is not the problem.

Does anyone know what I am doing wrong?

Thanks,

Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/attachments/20100113/05a80278/attachment-0005.htm>


More information about the TRNSYS-users mailing list