This is the mail archive of the
mailing list for the Cygwin project.
An issue with Matlab for a mex file compiled with GNU CYGWIN g++
- From: Emad Gad <egad at eecs dot uottawa dot ca>
- To: cygwin at cygwin dot com
- Date: Sun, 30 Jun 2013 19:27:26 -0700 (PDT)
- Subject: An issue with Matlab for a mex file compiled with GNU CYGWIN g++
I apologize that this message is a long one. But you may skip to the
question at the end, if you wish to know the troubles I am having.
I have been using LINUX for a very long time.
I decided to compile my work on CYGWIN. Furthermore, I wanted to compile a
Matlab interface to be able to use it from Matlab under Windows.
I succeeded, after plodding for a whole weekend, in compiling everything,
The problem came when I tried to run the matlab interface, which is the
usual .mexw64 (on the recent versions of Matlab) file that is produced by
the mex uttility in Matlab. At that moment, Matlab complained of âInvalid
mex file: [the file name].mexw64 is not a valid Win32 applicationâ
I know that, up until now, the problem does not seem even remotely related
However, investigating and reading around the web about this issue further
has led me to conclude that Matlab will generate this error if the .mexw64
the dll in question refers or uses other 32 bit dll. Matlab presumably
cannot run a hybrid dll, that is a dll with 64 and 32 bits components.
I then used the âDependency Walkerâ tool to examine the components of my
.mexw64. And I found out that my â.mexw64â file is linked to the following
library C:\Windows\system32\kernel32.dll, which is a flagrantly 32 bit
Windows system dll. So I assumed that this must be the reason that Matlab
failed to run the mex file, and wanted to know why this library got linked
in the first place.
That brings me to the CYGWIN connection: The CYGWIN linker that I invoked to
finish the job is the g++-4, which has added the library kernel32.dll, with
the linker flag âlkernel32.dll. Notice that this linker flag has been aded
by the linker, and not by me. It also added the 32-bit Windows path on the
Library paths, and that is how I ended up putting a 32-bit dll in the
structure of 64 bit mex file.
And that finally brings me to the main point of my post, and my question.
Is there a way to make the CYGWIN g++ linker choose the Windows 64 bit
system libraries instead of the 32 bit?
View this message in context: http://cygwin.1069669.n5.nabble.com/An-issue-with-Matlab-for-a-mex-file-compiled-with-GNU-CYGWIN-g-tp100307.html
Sent from the Cygwin list mailing list archive at Nabble.com.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple