Thread Subject: Invalid MEX-file Error

Subject: Invalid MEX-file Error

From: Marco Digiacomo

Date: 8 Feb, 2008 10:41:03

Message: 1 of 13

Hello

I have a problem with matlab 2007b.

When I try to execute a function that use a DLL file, this
error message appears:

??? Invalid MEX-file 'C:\mytoolbox\my2text.dll':
C:\mytoolbox\my2text.dll is not a valid Win32 application.

This error wasn't appear with Matlab 7.0

What's the problem?

Subject: Invalid MEX-file Error

From: Gadi Reinhorn

Date: 8 Feb, 2008 16:01:31

Message: 2 of 13

Marco,

This is not an error issued by MATLAB. It is a system error. A quick
google search found:
http://www.computerhope.com/issues/ch000726.htm

It's likely something wrong with the file and or your system. Are you on a
different architecture?

You can find more clues by using the dependency walker tool described in:
http://www.mathworks.com/support/solutions/data/1-2RQL4L.html

Good luck,
Gadi


"Marco Digiacomo" <manduriomane@mathworks.com> wrote in message
news:fohbjv$265$1@fred.mathworks.com...
> Hello
>
> I have a problem with matlab 2007b.
>
> When I try to execute a function that use a DLL file, this
> error message appears:
>
> ??? Invalid MEX-file 'C:\mytoolbox\my2text.dll':
> C:\mytoolbox\my2text.dll is not a valid Win32 application.
>
> This error wasn't appear with Matlab 7.0
>
> What's the problem?

Subject: Invalid MEX-file Error

From: Marco Digiacomo

Date: 8 Feb, 2008 19:43:01

Message: 3 of 13

Hi Gadi

on my PC I have installed both version of Matlab: 7.0 and
7.5.

When I use the DLL file with Matlab 7.0 the function that
use this library is performed correctly.

Intstead, when I use this library with Matlab 7.5, the
error message appears.

Subject: Invalid MEX-file Error

From: Marco Digiacomo

Date: 9 Feb, 2008 12:11:02

Message: 4 of 13

Help me!

Subject: Invalid MEX-file Error

From: Scott

Date: 16 Apr, 2008 13:12:02

Message: 5 of 13

"Marco Digiacomo" <manduriomane@mathworks.com> wrote in
message <foibc5$p9e$1@fred.mathworks.com>...
> Hi Gadi
>
> on my PC I have installed both version of Matlab: 7.0 and
> 7.5.
>
> When I use the DLL file with Matlab 7.0 the function that
> use this library is performed correctly.
>
> Intstead, when I use this library with Matlab 7.5, the
> error message appears.

I have experienced a similar problem. Hopefully someone
knows how to resolve this issue.

Subject: Invalid MEX-file Error

From: Scott

Date: 16 Apr, 2008 13:12:03

Message: 6 of 13

"Marco Digiacomo" <manduriomane@mathworks.com> wrote in
message <foibc5$p9e$1@fred.mathworks.com>...
> Hi Gadi
>
> on my PC I have installed both version of Matlab: 7.0 and
> 7.5.
>
> When I use the DLL file with Matlab 7.0 the function that
> use this library is performed correctly.
>
> Intstead, when I use this library with Matlab 7.5, the
> error message appears.

I have experienced a similar problem. Hopefully someone
knows how to resolve this issue.

Subject: Invalid MEX-file Error

From: Gadi Reinhorn

Date: 16 Apr, 2008 16:34:47

Message: 7 of 13

Marco and Scott,

Can you report what results you have found from your use of the dependency
walker?

There are many reasons this may have happened. We publish some that we know
about in our release notes:
http://www.mathworks.com/access/helpdesk/help/techdoc/rn/bq80uxu-1.html
You might have to look through the all releases we have had between 7.0 and
7.5 to find the reason.

As a note, we try our best to maintain binary compatibility of MEX-files for
several releases. Unfortunately, this is not always possible. We recommend
that you rebuild your MEX-files for every new release of MATLAB to ensure
that they will continue working.

Gadi



"Marco Digiacomo" <manduriomane@mathworks.com> wrote in message
news:foibc5$p9e$1@fred.mathworks.com...
> Hi Gadi
>
> on my PC I have installed both version of Matlab: 7.0 and
> 7.5.
>
> When I use the DLL file with Matlab 7.0 the function that
> use this library is performed correctly.
>
> Intstead, when I use this library with Matlab 7.5, the
> error message appears.

Subject: Invalid MEX-file Error

From: Yong Huang

Date: 17 Sep, 2008 19:08:03

Message: 8 of 13

Have you tried to rebuild the C code in matlab?
mex your_c_file.c

> "Marco Digiacomo" <manduriomane@mathworks.com> wrote in message
> news:foibc5$p9e$1@fred.mathworks.com...
> > Hi Gadi
> >
> > on my PC I have installed both version of Matlab: 7.0 and
> > 7.5.
> >
> > When I use the DLL file with Matlab 7.0 the function that
> > use this library is performed correctly.
> >
> > Intstead, when I use this library with Matlab 7.5, the
> > error message appears.
>
>

Subject: Invalid MEX-file Error

From: Joaquim Luis

Date: 17 Sep, 2008 20:56:03

Message: 9 of 13

"Gadi Reinhorn" <greinhor@mathworks.com> wrote in message <fu59r8$3kq$1@fred.mathworks.com>...
> Marco and Scott,
>
> Can you report what results you have found from your use of the dependency
> walker?
>
> There are many reasons this may have happened. We publish some that we know
> about in our release notes:
> http://www.mathworks.com/access/helpdesk/help/techdoc/rn/bq80uxu-1.html
> You might have to look through the all releases we have had between 7.0 and
> 7.5 to find the reason.
>
> As a note, we try our best to maintain binary compatibility of MEX-files for
> several releases. Unfortunately, this is not always possible. We recommend
> that you rebuild your MEX-files for every new release of MATLAB to ensure
> that they will continue working.
>
> Gadi

Gadi,

As another note and if you forgive my rudeness I find that recommendation totally unaceptable. TMW should try harder to maintain mex compatibility. You see, when we share mexs between users it's just crazy the idea that one should create as many mex as Matlab versions (2 per year now) so that one of them is the right one to a particular user.

J. Luis

Subject: Invalid MEX-file Error

From: Matt Fig

Date: 18 Sep, 2008 01:51:01

Message: 10 of 13

I am not sure if this applies to this situation or not, but a couple versions ago Matlab changed the mex-file extension from .dll to .mexw32. Simply changing the extension might not work. You will probably have to recompile.

Subject: Invalid MEX-file Error

From: Jing

Date: 15 Oct, 2009 04:03:19

Message: 11 of 13

"Matt Fig" <spamanon@yahoo.com> wrote in message <gasc65$haf$1@fred.mathworks.com>...
> I am not sure if this applies to this situation or not, but a couple versions ago Matlab changed the mex-file extension from .dll to .mexw32. Simply changing the extension might not work. You will probably have to recompile.

use the Matlab command: mex [your .c files]
See details for its arguments using "help mex or doc mex"

Subject: Invalid MEX-file Error

From: Gerardo Rosiles

Date: 24 Nov, 2009 07:05:24

Message: 12 of 13

I have code from other researchers that had been working since 1997. I have gone through at least six PC/laptops since then without problem.

I tried recompiling using the lcc compiler and got a bunch of compiling errors. Any suggestions or updates on this issue.

Thanks

Subject: Invalid MEX-file Error

From: Jan Simon

Date: 24 Nov, 2009 09:02:04

Message: 13 of 13

Dear Gerardo!

> I have code from other researchers that had been working since 1997. I have gone through at least six PC/laptops since then without problem.
>
> I tried recompiling using the lcc compiler and got a bunch of compiling errors. Any suggestions or updates on this issue.

It is not surprising that C-mex source from 1997 is not compatible with a current Matlab release. Of course compiling errors appear for numerous functions, which are not part of Matlab anymore, e.g. the creation of logical array have been changed, bacause LOGICALs are a class now, and not DOUBLE arrays with an extra flag.
  Matlab 5.3:
    Array = mxCreateDoubleMatrix(1, 1, mxREAL);
    *mxGetPr(Array) = 1.0;
    mxSetLogical(Array);
  Matlab 6.0:
    Array = mxCreateScalarDouble(1.0);
    mxSetLogical(Array);
  Matlab 6.5:
    Array = mxCreateLogicalScalar(1);
    (by the way: "mxCreateScalarDouble" is called "mxCreateDoubleScalar" now).

Although a lack of backward compatibility is a drawback in general, implementing new features is helpful - e.g. the new LOGICAL class takes less memory.

Solution for your LCC compiling errors:
Show us the error message and the corresponding lines of the source.

Kind regards, Jan

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com