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.

Respuestas (1)

Friedrich
Friedrich el 14 de Ag. de 2011

0 votos

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 comentario

Vicky
Vicky el 16 de Ag. de 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).

Iniciar sesión para comentar.

Categorías

Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Centro de ayuda y File Exchange.

Preguntada:

el 14 de Ag. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by