Hi,

I’m a developer of Dynare [1], an open-source GPL’d project which runs on top
of GNU Octave and alternatively on top of the commercial software MATLAB.

I’ve been using mingw-w64 for compiling DLLs loaded from Octave/MATLAB (these
DLLs are called “MEX files” in the MATLAB terminology), and your work at
mingw-w64 helps me a lot, for both the 32-bit and 64-bit platforms (I can now
get rid of MS Visual C++).

However, there is still an issue that I can’t solve by myself, hence this
e-mail : I keep getting crashes on the 64-bit platform (but not on 32-bit) when
exceptions are thrown by the DLL and should be catched by MATLAB (note that
there is no 64-bit build of Octave as of today, so I can’t test the problem
with it).

More precisely, I have a DLL (here called “mjdgges.mexw64”) which is called by
MATLAB. Under normal circumstances, this DLL works fine. But in some cases
where it is necessary to display an error message, my DLL calls a MATLAB
primitive (which resides in another DLL provided by MATLAB), to generate an
exception which should be catched by top-level MATLAB.

So the calling graph is: MATLAB -> mjdgges.mexw64 -> libmex.dll.

The exception is generated by libmex.dll, then propagated to mjdgges.mexw64 and
then to MATLAB, which should catch it.

Under 32-bit (i.e. a 32-bit Windows, a 32-bit MATLAB, and a Win32 targeted
mingw-w64), this works fine. But under 64-bit (i.e. a 64-bit Windows, a 64-bit
MATLAB, and a Win64 targeted mingw-w64), MATLAB crashes. Also note that if I
compile the DLL with MS Visual C++ for x64, the problem does not occur.

Using GDB, it seems that MATLAB crashes because of an illegal instruction from
within ntdll!RtlRaiseStatus(). I don’t know if this is very reliable
information.

Note that since the “mjdgges.mexw64” DLL is C code, I compile and link it with
“-fexceptions”. Also note that the problem occurs both with and without
“-static-libgcc”. I use automated builds of Mingw-w64 cross-compiler from Linux
(I tried both the stable version [2] and the development version [3]).

Any ideas of how to fix this ? Do you have any guidelines to help debug this ?
Thanks in advance.

Best regards,

[1] http://www.dynare.org
[2] mingw-w64-1.0-bin_x86_64-linux_20100823.tar.bz2
[3] mingw-w64-bin_x86_64-linux_20100830.tar.bz2

-- 
Sébastien Villemot
CEPREMAP — http://www.cepremap.ens.fr
Dynare project — http://www.dynare.org
Phone: +33 1 40 77 49 90
PGP Key: 0xA6C029B9D06B2913D71C105EBE37E801FB6EFF8B (http://pgp.mit.edu/)

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to