k_order_perturbation DLL works under Windows XP and Octave when compiled under Cygwin (with gcc-4), but it is necessary to add -D_WIN32 when compiling, in order to avoid the dlopen/dlclose functions. If these functions are present, Octave refuses to load the DLL.
I'm going to check with Matlab now
Best
Michel
Dear Michel
Thanks for pointing that missing definition: -D_WIN32 is indeed needed for successful compilation of dynamic_dll.cpp under windows so it should be defined by the Makefile
However, adding that definition and recompiling dynamic_dll for new instance of k_order_perturbation did not help on my machine under Matlab.
Best regards
George
----- Original Message ----- From: "Michel Juillard" michel.juillard@ens.fr To: "List for Dynare developers" dev@dynare.org Sent: Saturday, December 05, 2009 3:32 PM Subject: [DynareDev] k_order_perturbation under Windows
k_order_perturbation DLL works under Windows XP and Octave when compiled under Cygwin (with gcc-4), but it is necessary to add -D_WIN32 when compiling, in order to avoid the dlopen/dlclose functions. If these functions are present, Octave refuses to load the DLL.
I'm going to check with Matlab now
Best
Michel
Dev mailing list Dev@dynare.org http://www.dynare.org/cgi-bin/mailman/listinfo/dev
PS This find helps to locate place of crash closer as the crash thus seems to happen before loading model_dynamic.dll, in preamble of k_order_perturbation.cpp.
There is DynareMxArrayToString() being called before creating Dynamic DLL class and that function seem to have been pretty modified in meantime .
My old version of DLL (using old version of DynareMxArrayToString() works fine. However, all of the #ifdef DEBUG ... statements used for debugging DLL run under Matlab are also removed from the new code so it is now difficult to point to the place of the crash more precisely.
I will investigate this crash further
----- Original Message ----- From: "G. Perendia" george@perendia.orangehome.co.uk To: "List for Dynare developers" dev@dynare.org Sent: Saturday, December 05, 2009 4:54 PM Subject: Re: [DynareDev] k_order_perturbation under Windows
Dear Michel
Thanks for pointing that missing definition: -D_WIN32 is indeed needed
for
successful compilation of dynamic_dll.cpp under windows so it should be defined by the Makefile
However, adding that definition and recompiling dynamic_dll for new
instance
of k_order_perturbation did not help on my machine under Matlab.
Best regards
George
----- Original Message ----- From: "Michel Juillard" michel.juillard@ens.fr To: "List for Dynare developers" dev@dynare.org Sent: Saturday, December 05, 2009 3:32 PM Subject: [DynareDev] k_order_perturbation under Windows
k_order_perturbation DLL works under Windows XP and Octave when compiled under Cygwin (with gcc-4), but it is necessary to add -D_WIN32 when compiling, in order to avoid the dlopen/dlclose functions. If these functions are present, Octave refuses to load the DLL.
I'm going to check with Matlab now
Best
Michel
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
Hi George,
the mexPrintf in the DLL give misleading information, because of output buffering. They may not appear on the Matlab screen even if the bug is after their position in the code.
I have it now working in Matlab 7.4 (r2007a) with cygwin (gcc-3 -mno-cygwin).
My last problem was to have the <file_name>_dynamic DLL created with Dynamic among the export names. I was able to hack gnumex installation in order to do it,
However, I still don't know which simple solution, we can suggest for people to install a compiler to make Mex file from Matlab and have the Dynamic function visible. Trying to find a solution, I found that gnumex was again out of date and is confused by the cohabitation of gcc-3 and gcc-4 in current Cygwin install. Visual C++ express 2008 is too recent for older Matlab versions. Maybe the hacked mexpopts.bat that I made for Cygwin a couple of years ago is a temporary solution.
In summary: 1) add -D_WIN32 in the build system for Windows/Cygwin 2) find a solution for compiling the users' DLL (<fname>_dynamic.c) under Windows
Best,
Michel
G. Perendia wrote:
PS This find helps to locate place of crash closer as the crash thus seems to happen before loading model_dynamic.dll, in preamble of k_order_perturbation.cpp.
There is DynareMxArrayToString() being called before creating Dynamic DLL class and that function seem to have been pretty modified in meantime .
My old version of DLL (using old version of DynareMxArrayToString() works fine. However, all of the #ifdef DEBUG ... statements used for debugging DLL run under Matlab are also removed from the new code so it is now difficult to point to the place of the crash more precisely.
I will investigate this crash further
----- Original Message ----- From: "G. Perendia" george@perendia.orangehome.co.uk To: "List for Dynare developers" dev@dynare.org Sent: Saturday, December 05, 2009 4:54 PM Subject: Re: [DynareDev] k_order_perturbation under Windows
Dear Michel
Thanks for pointing that missing definition: -D_WIN32 is indeed needed
for
successful compilation of dynamic_dll.cpp under windows so it should be defined by the Makefile
However, adding that definition and recompiling dynamic_dll for new
instance
of k_order_perturbation did not help on my machine under Matlab.
Best regards
George
----- Original Message ----- From: "Michel Juillard" michel.juillard@ens.fr To: "List for Dynare developers" dev@dynare.org Sent: Saturday, December 05, 2009 3:32 PM Subject: [DynareDev] k_order_perturbation under Windows
k_order_perturbation DLL works under Windows XP and Octave when compiled under Cygwin (with gcc-4), but it is necessary to add -D_WIN32 when compiling, in order to avoid the dlopen/dlclose functions. If these functions are present, Octave refuses to load the DLL.
I'm going to check with Matlab now
Best
Michel
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
Dev mailing list Dev@dynare.org http://www.dynare.org/cgi-bin/mailman/listinfo/dev
Le samedi 05 décembre 2009 à 22:11 +0100, Michel Juillard a écrit :
- add -D_WIN32 in the build system for Windows/Cygwin
Actually definining _WIN32 is a bad practice for Cygwin, and for instance makes the compilation of dynare++ fail.
The right solution is to replace:
#ifdef _WIN32 by #if defined(_WIN32) || defined(__CYGWIN32__)
and:
#ifndef _WIN32 by #if !defined(_WIN32) && !defined(__CYGWIN32__)
Best
Hi Michel and Sebastien
The mexopts.bat I sent back on Thursday (based on yours) was doing that export ok - otherwise neither my old DLL or DsgeLikelihood.DLL would have worked.
As I mentioned, adding -D_WIN32 did not help either.
However, using DEBUG and mexPrintfs I located that what was causing crashes on my system (Windows 7 64 bit with 32 bit Matlab 7.1) was a remaining mxFree() which was trying to free all memory allocated by several calloc calls in DynareMxArrayToString in k_order_perturbation.cpp (i.e.in some recent changes mxCalloc-s were replaced by generic calloc-s but not the mxFree)
I however also radically refactored DynareMxArrayToString and took whole second part of that function out and that seems to be ok - at least on my system - let me know if that is causing problem on yours.
I also changed #ifdef to #if defined() in dynamic_dll.cpp as Sebastien recommended.
Best regards
George
----- Original Message ----- From: "Michel Juillard" michel.juillard@ens.fr To: "List for Dynare developers" dev@dynare.org Sent: Saturday, December 05, 2009 9:11 PM Subject: Re: [DynareDev] k_order_perturbation under Windows
Hi George,
the mexPrintf in the DLL give misleading information, because of output buffering. They may not appear on the Matlab screen even if the bug is after their position in the code.
I have it now working in Matlab 7.4 (r2007a) with cygwin (gcc-3 -mno-cygwin).
My last problem was to have the <file_name>_dynamic DLL created with Dynamic among the export names. I was able to hack gnumex installation in order to do it,
However, I still don't know which simple solution, we can suggest for people to install a compiler to make Mex file from Matlab and have the Dynamic function visible. Trying to find a solution, I found that gnumex was again out of date and is confused by the cohabitation of gcc-3 and gcc-4 in current Cygwin install. Visual C++ express 2008 is too recent for older Matlab versions. Maybe the hacked mexpopts.bat that I made for Cygwin a couple of years ago is a temporary solution.
In summary:
- add -D_WIN32 in the build system for Windows/Cygwin
- find a solution for compiling the users' DLL (<fname>_dynamic.c)
under Windows
Best,
Michel
G. Perendia wrote:
PS This find helps to locate place of crash closer as the crash thus seems
to
happen before loading model_dynamic.dll, in preamble of k_order_perturbation.cpp.
There is DynareMxArrayToString() being called before creating Dynamic
DLL
class and that function seem to have been pretty modified in meantime .
My old version of DLL (using old version of DynareMxArrayToString()
works
fine. However, all of the #ifdef DEBUG ... statements used for
debugging
DLL run under Matlab are also removed from the new code so it is now difficult to point to the place of the crash more precisely.
I will investigate this crash further
----- Original Message ----- From: "G. Perendia" george@perendia.orangehome.co.uk To: "List for Dynare developers" dev@dynare.org Sent: Saturday, December 05, 2009 4:54 PM Subject: Re: [DynareDev] k_order_perturbation under Windows
Dear Michel
Thanks for pointing that missing definition: -D_WIN32 is indeed needed
for
successful compilation of dynamic_dll.cpp under windows so it should be defined by the Makefile
However, adding that definition and recompiling dynamic_dll for new
instance
of k_order_perturbation did not help on my machine under Matlab.
Best regards
George
----- Original Message ----- From: "Michel Juillard" michel.juillard@ens.fr To: "List for Dynare developers" dev@dynare.org Sent: Saturday, December 05, 2009 3:32 PM Subject: [DynareDev] k_order_perturbation under Windows
k_order_perturbation DLL works under Windows XP and Octave when
compiled
under Cygwin (with gcc-4), but it is necessary to add -D_WIN32 when compiling, in order to avoid the dlopen/dlclose functions. If these functions are present, Octave refuses to load the DLL.
I'm going to check with Matlab now
Best
Michel
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
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
Thanks George
Best
Michel
G. Perendia wrote:
Hi Michel and Sebastien
The mexopts.bat I sent back on Thursday (based on yours) was doing that export ok - otherwise neither my old DLL or DsgeLikelihood.DLL would have worked.
As I mentioned, adding -D_WIN32 did not help either.
However, using DEBUG and mexPrintfs I located that what was causing crashes on my system (Windows 7 64 bit with 32 bit Matlab 7.1) was a remaining mxFree() which was trying to free all memory allocated by several calloc calls in DynareMxArrayToString in k_order_perturbation.cpp (i.e.in some recent changes mxCalloc-s were replaced by generic calloc-s but not the mxFree)
I however also radically refactored DynareMxArrayToString and took whole second part of that function out and that seems to be ok - at least on my system - let me know if that is causing problem on yours.
I also changed #ifdef to #if defined() in dynamic_dll.cpp as Sebastien recommended.
Best regards
George
----- Original Message ----- From: "Michel Juillard" michel.juillard@ens.fr To: "List for Dynare developers" dev@dynare.org Sent: Saturday, December 05, 2009 9:11 PM Subject: Re: [DynareDev] k_order_perturbation under Windows
Hi George,
the mexPrintf in the DLL give misleading information, because of output buffering. They may not appear on the Matlab screen even if the bug is after their position in the code.
I have it now working in Matlab 7.4 (r2007a) with cygwin (gcc-3 -mno-cygwin).
My last problem was to have the <file_name>_dynamic DLL created with Dynamic among the export names. I was able to hack gnumex installation in order to do it,
However, I still don't know which simple solution, we can suggest for people to install a compiler to make Mex file from Matlab and have the Dynamic function visible. Trying to find a solution, I found that gnumex was again out of date and is confused by the cohabitation of gcc-3 and gcc-4 in current Cygwin install. Visual C++ express 2008 is too recent for older Matlab versions. Maybe the hacked mexpopts.bat that I made for Cygwin a couple of years ago is a temporary solution.
In summary:
- add -D_WIN32 in the build system for Windows/Cygwin
- find a solution for compiling the users' DLL (<fname>_dynamic.c)
under Windows
Best,
Michel
G. Perendia wrote:
PS This find helps to locate place of crash closer as the crash thus seems
to
happen before loading model_dynamic.dll, in preamble of k_order_perturbation.cpp.
There is DynareMxArrayToString() being called before creating Dynamic
DLL
class and that function seem to have been pretty modified in meantime .
My old version of DLL (using old version of DynareMxArrayToString()
works
fine. However, all of the #ifdef DEBUG ... statements used for
debugging
DLL run under Matlab are also removed from the new code so it is now difficult to point to the place of the crash more precisely.
I will investigate this crash further
----- Original Message ----- From: "G. Perendia" george@perendia.orangehome.co.uk To: "List for Dynare developers" dev@dynare.org Sent: Saturday, December 05, 2009 4:54 PM Subject: Re: [DynareDev] k_order_perturbation under Windows
Dear Michel
Thanks for pointing that missing definition: -D_WIN32 is indeed needed
for
successful compilation of dynamic_dll.cpp under windows so it should be defined by the Makefile
However, adding that definition and recompiling dynamic_dll for new
instance
of k_order_perturbation did not help on my machine under Matlab.
Best regards
George
----- Original Message ----- From: "Michel Juillard" michel.juillard@ens.fr To: "List for Dynare developers" dev@dynare.org Sent: Saturday, December 05, 2009 3:32 PM Subject: [DynareDev] k_order_perturbation under Windows
k_order_perturbation DLL works under Windows XP and Octave when
compiled
under Cygwin (with gcc-4), but it is necessary to add -D_WIN32 when compiling, in order to avoid the dlopen/dlclose functions. If these functions are present, Octave refuses to load the DLL.
I'm going to check with Matlab now
Best
Michel
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
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
Dev mailing list Dev@dynare.org http://www.dynare.org/cgi-bin/mailman/listinfo/dev
Hi Did anyone managed to run <model>_dynamic.mex* compiled with Matlab lcc with k_order_perturbation? Despite exporting Dynamic explicitly for lcc, (as for gcc as in the mexopts.bat I sent), k_order_perturbation (under Windows Matlab) still does not seem to be able to load the Dynamic function.
An alternative may be to try to call mexFunction from k_order_perturbation's dynamic_dll only if calling Dynamic() directly fails (e.g. for the lcc users). Another alternative may be to change <modelname>_dynamic.c so that there is no separate Dynamic function but only mexFunction. In both cases k_order_perturbation's dynamic_dll wil need to be changed to call mexFunction
Best regards
George ----- Original Message ----- From: "Michel Juillard" michel.juillard@ens.fr To: "List for Dynare developers" dev@dynare.org Sent: Sunday, December 06, 2009 12:42 PM Subject: Re: [DynareDev] k_order_perturbation under Windows
Thanks George
Best
Michel
G. Perendia wrote:
Hi Michel and Sebastien
The mexopts.bat I sent back on Thursday (based on yours) was doing that export ok - otherwise neither my old DLL or DsgeLikelihood.DLL would
have
worked.
As I mentioned, adding -D_WIN32 did not help either.
However, using DEBUG and mexPrintfs I located that what was causing
crashes
on my system (Windows 7 64 bit with 32 bit Matlab 7.1) was a remaining mxFree() which was trying to free all memory allocated by several calloc calls in DynareMxArrayToString in k_order_perturbation.cpp (i.e.in some recent changes mxCalloc-s were replaced by generic calloc-s but not the mxFree)
I however also radically refactored DynareMxArrayToString and took
whole
second part of that function out and that seems to be ok - at least on
my
system - let me know if that is causing problem on yours.
I also changed #ifdef to #if defined() in dynamic_dll.cpp as Sebastien recommended.
Best regards
George
----- Original Message ----- From: "Michel Juillard" michel.juillard@ens.fr To: "List for Dynare developers" dev@dynare.org Sent: Saturday, December 05, 2009 9:11 PM Subject: Re: [DynareDev] k_order_perturbation under Windows
Hi George,
the mexPrintf in the DLL give misleading information, because of output buffering. They may not appear on the Matlab screen even if the bug is after their position in the code.
I have it now working in Matlab 7.4 (r2007a) with cygwin (gcc-3 -mno-cygwin).
My last problem was to have the <file_name>_dynamic DLL created with Dynamic among the export names. I was able to hack gnumex installation in order to do it,
However, I still don't know which simple solution, we can suggest for people to install a compiler to make Mex file from Matlab and have the Dynamic function visible. Trying to find a solution, I found that
gnumex
was again out of date and is confused by the cohabitation of gcc-3 and gcc-4 in current Cygwin install. Visual C++ express 2008 is too recent for older Matlab versions. Maybe the hacked mexpopts.bat that I made
for
Cygwin a couple of years ago is a temporary solution.
In summary:
- add -D_WIN32 in the build system for Windows/Cygwin
- find a solution for compiling the users' DLL (<fname>_dynamic.c)
under Windows
Best,
Michel
G. Perendia wrote:
PS This find helps to locate place of crash closer as the crash thus
seems
to
happen before loading model_dynamic.dll, in preamble of k_order_perturbation.cpp.
There is DynareMxArrayToString() being called before creating Dynamic
DLL
class and that function seem to have been pretty modified in meantime
.
My old version of DLL (using old version of DynareMxArrayToString()
works
fine. However, all of the #ifdef DEBUG ... statements used for
debugging
DLL run under Matlab are also removed from the new code so it is now difficult to point to the place of the crash more precisely.
I will investigate this crash further
----- Original Message ----- From: "G. Perendia" george@perendia.orangehome.co.uk To: "List for Dynare developers" dev@dynare.org Sent: Saturday, December 05, 2009 4:54 PM Subject: Re: [DynareDev] k_order_perturbation under Windows
Dear Michel
Thanks for pointing that missing definition: -D_WIN32 is indeed
needed
for
successful compilation of dynamic_dll.cpp under windows so it should
be
defined by the Makefile
However, adding that definition and recompiling dynamic_dll for new
instance
of k_order_perturbation did not help on my machine under Matlab.
Best regards
George
----- Original Message ----- From: "Michel Juillard" michel.juillard@ens.fr To: "List for Dynare developers" dev@dynare.org Sent: Saturday, December 05, 2009 3:32 PM Subject: [DynareDev] k_order_perturbation under Windows
k_order_perturbation DLL works under Windows XP and Octave when
compiled
under Cygwin (with gcc-4), but it is necessary to add -D_WIN32 when compiling, in order to avoid the dlopen/dlclose functions. If these functions are present, Octave refuses to load the DLL.
I'm going to check with Matlab now
Best
Michel
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
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
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
Hi,
I have tested k-order and it works fine under Linux/Octave and Linux/MATLAB.
Le mardi 08 décembre 2009 à 09:38 +0000, G. Perendia a écrit :
Did anyone managed to run <model>_dynamic.mex* compiled with Matlab lcc with k_order_perturbation? Despite exporting Dynamic explicitly for lcc, (as for gcc as in the mexopts.bat I sent), k_order_perturbation (under Windows Matlab) still does not seem to be able to load the Dynamic function.
Under Windows, I have the same problem when trying to compile the MEX file with MS Visual C++. Previously I had a MATLAB crash, now I have an error message indicating that MATLAB can't find the "Dynamic" symbol in the MEX.
So unless we figure out how to change the exported symbols with LCC and Visual C++, the only supported compiler for k-order will be GCC.
An alternative may be to try to call mexFunction from k_order_perturbation's dynamic_dll only if calling Dynamic() directly fails (e.g. for the lcc users). Another alternative may be to change <modelname>_dynamic.c so that there is no separate Dynamic function but only mexFunction. In both cases k_order_perturbation's dynamic_dll wil need to be changed to call mexFunction
We shouldn't modify existing mexFunction, because some users (at least Stéphane! ;) want to keep the USE_DLL option as it is now.
Also remember that using a MEX for the dynamic model in k-order is only a temporary solution for Dynare 4.1. In the next 4.2 release of Dynare, we will use the bytecode as a replacement.
Best