[TRNSYS-users] Calling MESSAGES function in C++
keilholz, werner
werner.keilholz at cstb.fr
Fri Jul 17 05:33:39 PDT 2009
I am told Severity values should read "NOTICE", "WARNING", "FATAL" or "STOP" - sorry for the typo.
Werner
________________________________
De : keilholz, werner [mailto:werner.keilholz at cstb.fr]
Envoyé : vendredi 17 juillet 2009 12:23
À : Eric Wilson; trnsys-users at cae.wisc.edu
Objet : Re: [TRNSYS-users] Calling MESSAGES function in C++
1. Add to Trnsys.h :
extern "C" __declspec(dllimport) void _cdecl MESSAGES(int* errorCode,char* message, char* severity, int* unitNo, int* typeNo, int n, int m);
2. Use :
char Message[800];
strcpy(Message, "Its before 10");
char Severity[10];
strcpy(Severity, "NOTICE");
int errCode = 1;
int Unit = 4; // put your unit number here - typically info[0]
int Type = 6; // put your type number here - typically info[1]
if (time < 10)
messages(&errCode, Message, Severity, &Unit, &Type, strlen(Message), strlen(Severity));
Severity can be « NOTICE », « WARNING » or «ERROR»
The 'trick' is that FORTRAN passes string lengths as additional, hidden arguments - you have to add them at the end of any function using one or several strings as an argument, in the same order as the arguments (one per string passed). (See Trnsys.h or TrnsysFunctions.f90 if the function is missing in Trnsys.h for function prototypes).
Werner
________________________________
De : ericjhwilson at gmail.com [mailto:ericjhwilson at gmail.com] De la part de Eric Wilson
Envoyé : vendredi 6 mars 2009 19:41
À : trnsys-users at cae.wisc.edu
Objet : [TRNSYS-users] Calling MESSAGES function in C++
Hello all,
I am trying to generate list file warning messages in my C++-compiled Type. According to the comments in the exported type C++ template, you use the "MESSAGES" function, which is not recognized by C++ (and I don't see it in Trnsys.h):
// REPORT ANY PROBLEMS THAT HAVE BEEN FOUND USING CALLS LIKE THIS:
MESSAGES(-1,'put your message here','MESSAGE',IUNIT,ITYPE)
In the Ch 08 Programmer's Guide, the syntax is:
call Messages(errorCode,message,severity,unitNo,typeNo)
...but that is for Fortran. Does anyone know how to do it in C++?
Thanks,
Eric
************************************************************************************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.
************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/attachments/20090717/10559036/attachment-0005.htm>
More information about the TRNSYS-users
mailing list