X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Date: Wed, 26 Sep 2007 10:23:57 -0400 (EDT)
From: Igor Peshansky <pechtcha@cs.nyu.edu>
Reply-To: cygwin@cygwin.com
To: Boyd Edmondson <BoydEdmondson@NebulaSoftware.COM>
cc: cygwin@cygwin.com
Subject: Re: MATLAB mexFunction() with Cygwin GCC Windows
In-Reply-To: <7C82AE18E63BBF46BFAC6364E1E4CA591087EE@nebulasoftware1.NebulaSoftware.com>
Message-ID: <Pine.GSO.4.63.0709261021550.16844@access1.cims.nyu.edu>
References: <7C82AE18E63BBF46BFAC6364E1E4CA591087EE@nebulasoftware1.NebulaSoftware.com>
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="-559023410-641078858-1190816637=:16844"
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

---559023410-641078858-1190816637=:16844
Content-Type: TEXT/PLAIN; charset=iso-8859-1
Content-Transfer-Encoding: 8BIT

On Wed, 26 Sep 2007, Boyd Edmondson wrote:

> I have successfully built/linked MATLAB mex files on Windows using GCC
> in Cygwin.  Unfortunately, it has a runtime error.  It appears the error
> is due to mismatched calling coventions for parameter passing.  The
> MATLAB interpreter successfully invokes the mexFunction() in my shared
> library (.mexw32), but the passed parameters are "corrupted".
>
> I've tried GCC's "attribute" to set the mexFunction() to "cdecl",
> "stdcall", and "fastcall", but still no luck.
>
> Anyone know the solution?
>
> Details follow:
>
> MATLAB mexopts.bat
> =================
> [snip]
> set COMPILER=gcc
> set COMPFLAGS=-mno-cygwin -D_WIN32 -shared -DMATLAB_MEX_FILE -Wall -c -msse3 -I"%ProgramFiles%\Pthreads\include" -I"%ProgramFiles%\Verasonics\Hal\Hal C\Includes" -o%MEX_NAME%.obj
                ^^^^^^^^^^^
> set LINKER=gcc
> set LINKFLAGS=-mno-cygwin -D_WIN32 -shared -DMATLAB_MEX_FILE -nostartfiles -L"%ProgramFiles%\Verasonics\Hal\Hal C\Shared Libraries" -lverasonicshalwindows -L"%ProgramFiles%\MATLAB\R2007a\bin\win32" -lmat -lmex -lmx
                ^^^^^^^^^^^
See the underlined portions above.  You're not using the Cygwin gcc,
you're really using the MinGW gcc that understands Cygwin paths.  So
you're better off asking on the MinGW list.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Belief can be manipulated.  Only knowledge is dangerous.  -- Frank Herbert

---559023410-641078858-1190816637=:16844
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
---559023410-641078858-1190816637=:16844--
