help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave crashes on old MEX-files: how can I detect/prevent this?


From: Mike Miller
Subject: Re: Octave crashes on old MEX-files: how can I detect/prevent this?
Date: Mon, 5 Dec 2016 12:53:43 -0800
User-agent: NeoMutt/20161104 (1.7.1)

On Mon, Dec 05, 2016 at 11:53:56 +0100, Julien Bect wrote:
> Le 05/12/2016 à 11:22, siko1056 a écrit :
> > AFAIK, there is no function to check a MEX-file to be valid for usage with a
> > certain version of Octave. If you want to check in advance whether your
> > version of Octave can handle a MEX-file, say myfunc.mex, try calling
> > 
> > try
> >    which myfunc
> > catch(e)
> >    disp("recompile MEX file!")
> >    disp(e.message)
> > end_try_catch
> > 
> > And you'll get errors in the case, that certain dynamic libraries cannot be
> > loaded, a necessary condition for this MEX-file to run, but not sufficient.
> 
> Thank you for your reply.
> 
> When I try "which myfunc" on the faulty MEX-file, I get the following error:
> 
> error: scope not found!
> error: called from
>     which at line 39 column 22
> 
> Is this the one you expect?
> 
> What does "scope not found" mean?

Part of the problem, maybe all of the problem, is that when Octave
builds oct files and mex files, it links them to the Octave shared
libraries. This is not strictly necessary on some/all operating systems,
because the file is loaded by Octave, and the symbols that these shared
objects need must have already been loaded into the running process.

So when you load a mex file that was built with Octave 4.0 in Octave
4.2, it is loading the runtime libraries from Octave 4.0 into the 4.2
process image. This is probably causing all of the problems that you are
seeing.

If you run `mkoctfile --mex --verbose myfunc.c`, you can see that the
link stage includes references to liboctinterp and liboctave. Try
executing that link stage without the -L and -l options, and see if the
resulting mex file can be used between Octave versions now.

-- 
mike



reply via email to

[Prev in Thread] Current Thread [Next in Thread]