Hi
I intend to change printf() calls in the <object>print() functions of some of the Dynare++ Sylv exceptions and Vector and GeneralMatrix to mexPrintf()and use following to switch between printf and mexPrintf()
#ifdef MATLAB #include "mex.h" #else #define mexPrintf printf #endif
Is that OK or will this cause any problems?
Best regards
George
Hi George,
Le vendredi 20 novembre 2009 à 10:33 +0000, G. Perendia a écrit :
I intend to change printf() calls in the <object>print() functions of some of the Dynare++ Sylv exceptions and Vector and GeneralMatrix to mexPrintf()and use following to switch between printf and mexPrintf()
#ifdef MATLAB #include "mex.h" #else #define mexPrintf printf #endif
Is that OK or will this cause any problems?
I think it's ok.
However note that in the main Dynare++ trunk, I removed the MATLAB define, and replaced it by MATLAB_MEX_FILE and OCTAVE_MEX_FILE.
So your #ifdef will need to be replaced by:
#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
Therefore I can not stress to much the need to make sure that your Dynare++ source tree doesn't diverge too much from the official Dynare++ tree in dynare++/ subdir.
Best,
Thanks Sebastien
This kind of high-levle conflict is what I was worried about. I will then change #ifdef MATLAB to #ifdef MATLAB to #if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
Just to check, does then MATLAB_MEX_FILE and OCTAVE_MEX_FILE then apply to (i.e. is #defined for) all sources when being compiled for Matlab/Octave DLLs (e.g. inc. GeneralMatrix.cpp) or just to the main mexFunction files?
Best regards
George
----- Original Message ----- From: "Sébastien Villemot" sebastien.villemot@ens.fr To: "List for Dynare developers" dev@dynare.org Sent: Friday, November 20, 2009 10:42 AM Subject: Re: [DynareDev] printf in Vector and GeneralMatrix
Hi George,
Le vendredi 20 novembre 2009 à 10:33 +0000, G. Perendia a écrit :
I intend to change printf() calls in the <object>print() functions of some of the Dynare++ Sylv exceptions and Vector and GeneralMatrix to mexPrintf()and use following to switch between printf and mexPrintf()
#ifdef MATLAB #include "mex.h" #else #define mexPrintf printf #endif
Is that OK or will this cause any problems?
I think it's ok.
However note that in the main Dynare++ trunk, I removed the MATLAB define, and replaced it by MATLAB_MEX_FILE and OCTAVE_MEX_FILE.
So your #ifdef will need to be replaced by:
#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
Therefore I can not stress to much the need to make sure that your Dynare++ source tree doesn't diverge too much from the official Dynare++ tree in dynare++/ subdir.
Best,
Le vendredi 20 novembre 2009 à 12:04 +0000, G. Perendia a écrit :
This kind of high-levle conflict is what I was worried about. I will then change #ifdef MATLAB to #ifdef MATLAB to #if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
Just to check, does then MATLAB_MEX_FILE and OCTAVE_MEX_FILE then apply to (i.e. is #defined for) all sources when being compiled for Matlab/Octave DLLs (e.g. inc. GeneralMatrix.cpp) or just to the main mexFunction files?
To all sources included in a MEX file.
Best,
Hi George,
I'm not sure that it is a good idea. dynare++ is a standalone program, and it will not be clear for people looking at the code without knowing it that in normal dynare++ use, mexPrintf means printf.
It would be better to add mexPrint methods on the side of the print method for dynare++ objects and protect the new method with appropriate #if to compile those only when one uses dynare++ code to make a DLL.
Also, printing dynare++ objects is for the kind of debugging that is better done in a standalone test version of the code than in an actual DLL.
All the best,
Michel
G. Perendia wrote:
Hi
I intend to change printf() calls in the <object>print() functions of some of the Dynare++ Sylv exceptions and Vector and GeneralMatrix to mexPrintf()and use following to switch between printf and mexPrintf()
#ifdef MATLAB #include "mex.h" #else #define mexPrintf printf #endif Is that OK or will this cause any problems?
Best regards
George
Dev mailing list Dev@dynare.org http://www.dynare.org/cgi-bin/mailman/listinfo/dev
Thanks Michel
In addition to debugging, the mexPrintf is also useful (needed) for run-time exception message reporting which would similarly not be printed on Matlab screen. I will hence then just add mexPrintf conditional on MEX files being created
Best regards
George
----- Original Message ----- From: "Michel Juillard" michel.juillard@ens.fr To: "List for Dynare developers" dev@dynare.org Sent: Friday, November 20, 2009 2:09 PM Subject: Re: [DynareDev] printf in Vector and GeneralMatrix
Hi George,
I'm not sure that it is a good idea. dynare++ is a standalone program, and it will not be clear for people looking at the code without knowing it that in normal dynare++ use, mexPrintf means printf.
It would be better to add mexPrint methods on the side of the print method for dynare++ objects and protect the new method with appropriate #if to compile those only when one uses dynare++ code to make a DLL.
Also, printing dynare++ objects is for the kind of debugging that is better done in a standalone test version of the code than in an actual
DLL.
All the best,
Michel
G. Perendia wrote:
Hi
I intend to change printf() calls in the <object>print() functions of some of the Dynare++ Sylv exceptions and Vector and GeneralMatrix to mexPrintf()and use following to switch between printf and mexPrintf()
#ifdef MATLAB #include "mex.h" #else #define mexPrintf printf #endif Is that OK or will this cause any problems?
Best regards
George
Dev mailing list Dev@dynare.org http://www.dynare.org/cgi-bin/mailman/listinfo/dev
Dev mailing list Dev@dynare.org http://www.dynare.org/cgi-bin/mailman/listinfo/dev