From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3248 invoked by alias); 1 Jul 2013 02:27:30 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 3235 invoked by uid 89); 1 Jul 2013 02:27:29 -0000 X-Spam-SWARE-Status: No, score=3.1 required=5.0 tests=AWL,BAYES_00,SPF_SOFTFAIL,URI_HEX autolearn=no version=3.3.1 Received: from sam.nabble.com (HELO sam.nabble.com) (216.139.236.26) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 01 Jul 2013 02:27:28 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1UtTpu-0002B7-Lr for cygwin@cygwin.com; Sun, 30 Jun 2013 19:27:26 -0700 Date: Mon, 01 Jul 2013 02:27:00 -0000 From: Emad Gad To: cygwin@cygwin.com Message-ID: <1372645646643-100307.post@n5.nabble.com> Subject: An issue with Matlab for a mex file compiled with GNU CYGWIN g++ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2013-07/txt/msg00000.txt.bz2 Hello 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, without errors. 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 =E2=80=9CI= nvalid mex file: [the file name].mexw64 is not a valid Win32 application=E2=80=9D I know that, up until now, the problem does not seem even remotely related to CYGWIN. 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 =E2=80=9CDependency Walker=E2=80=9D tool to examine the com= ponents of my .mexw64. And I found out that my =E2=80=9C.mexw64=E2=80=9D file is linked t= o 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 =E2=80=93lkernel32.dll. Notice that this linker flag has be= en 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 FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple