How to use mex for C functions on MATLAB 7.10?

Hi. I have some of my own code developed for MATLAB R2007 which calls my own C function, which has been running fine for years. On MATLAB 7.10, running on Windows 7 (64-bit PC), I recompiled the C function with mex and got a .mex64 file. However MATLAB crashes when it reaches that point in the code. Using mex -setup I only get the Microsoft Visual 2008 compiler as an option and none of the built-in compilers that older MATLAB versions had. Is there some special setup of Visual Studio 2008 I should use? Or some other trick with mex? Can anyone help me please? Thanks.

Antworten (1)

Friedrich
Friedrich am 14 Aug. 2011

0 Stimmen

Hi,
you moved from 32bit to 64bit. Beware that the size of some datatypes changes. The best way here is to debug your mex file:
This will help you to figure out in which line your mex file crashes.

1 Kommentar

Vicky
Vicky am 16 Aug. 2011
Hi. Thanks a lot for your help. I'm aware of the datatype changes, but I would like to avoid having to change my C/mex file as this is old work and would slow me down terribly. I compiled my C function on one 64-bit PC using mex -compatibleArrayDims. It runs Ok on one PC but not on another 64-bit PC. Both have the Visual Studio 2008 compiler installed. Is it possible that some setup is required on the problem PC? Also please see my other related question, as I have the same problem on the MATLAB DCE cluster (running on 64-bit servers).

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 14 Aug. 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by