octave-maintainers
[Top][All Lists]
Advanced

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

Re: "clear all" problem for classes defined in oct-files (Was: : bug) (C


From: John W. Eaton
Subject: Re: "clear all" problem for classes defined in oct-files (Was: : bug) (Concerns: SWIG)
Date: Wed, 11 Jun 2008 16:22:00 -0400

On 28-May-2008, David Bateman wrote:

| Yes the fixed type has the same issue. The solution used in the fixed
| type is to "mlock" the constructor function in place when the package is
| loaded so that "clear all" won't remove it.. fixed.oct currently uses
| 
|   // Lock constructor function in place, otherwise
|   // "a=fixed(3,1); clear functions; a" generates a seg-fault!!
|   // The below is the function "mlock", but in a way useable
|   // for older versions of octave as well.
|   fbi_sym_tab->lookup("fixed")->mark_as_static ();
| 
| for this purpose as mlock wasn't in some older 2.1.x versions of Octave.
| However this is incompatible with 3.1.x, but mlock is incompatible
| between the 3.0 and 3.1 versions as well, or at least
| 
| void mlock (const std::string&)
| 
| doesn't exist in 3.1.x yet.. I'd suggest using the above in any case,
| and I believe we should readd the same function in 3.1.

I don't think we should need to have "mlock (NAME)".  Instead, you can
use the method posted by Jaroslav recently:  in the "fixed" function,
you can do

  octave_function *f = octave_call_stack::current ();
  if (f)
    f->lock ();

jwe


reply via email to

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