delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/06/30/22:27:47

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:message-id:subject:mime-version
:content-type:content-transfer-encoding; q=dns; s=default; b=Xnh
TmAzc1gCiAK/Bsk74bp2DQHZ67I4JFYrtQsqPgl7iTBVtb8HY8/eNEKPdKp9ecE1
B4Wr0sL4ZoPRbakNn3l2822+BQKdQa9HaMM+NkTqUx14oRE1ZvUFDy7LJMw8WxcH
lPP8g4iuW/0nniMKR8DTSnM33QsPeYOOBDqNMtqg=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:message-id:subject:mime-version
:content-type:content-transfer-encoding; s=default; bh=2r44uqbgS
MR5Wn8xLHwmzlqJ5sg=; b=ygUb9s9bElI3Z3xWJQNo8Wbi+66PJNrDDWGxjv0UK
VP4d8MoiJ+xjOLVbm83T3ybqpCovU16L6+Akw5jWkhqa8WTfEQPCyyJswgx5RrGk
VOaysg5yyTT9JDAJRnl0aPasCQEPcTRtkieU57LYtbz6vsAq2AoeF68Vo44cOd14
4E=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
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
Date: Sun, 30 Jun 2013 19:27:26 -0700 (PDT)
From: Emad Gad <egad AT eecs DOT uottawa DOT ca>
To: cygwin AT cygwin DOT 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
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id r612RgNC007990

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 “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
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 “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
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019