help-octave
[Top][All Lists]
Advanced

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

Re: Calling other functions from .oct files


From: Paul Kienzle
Subject: Re: Calling other functions from .oct files
Date: Fri, 02 May 2003 00:17:06 -0400
User-agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.3a) Gecko/20021212

John W. Eaton wrote:

On  1-May-2003, Paul Kienzle <address@hidden> wrote:

| On the other hand you should be able to call
| the computational stuff from another oct-file directly so
| that things in liboctave don't have special status.  In
| principle it is easy enough.

Sure, you could load the .oct file and get a pointer to the function
you need.  The problem with this is that it fails if someone clears
the function you just loaded, though I suppose you could get around
that if you didn't have a pointer to the function, but some other
object that could (efficiently) give you a pointer to the function,
but would also know if it needed to reload the function.

I was assuming that the load function would return quickly if
the function was already available.  I didn't consider the possibility
of the loaded function being cleared before your function exited.
A "smart pointer" which locks the oct-file until the pointer
destructor is called would protect against this.

(Maybe it should not be possible to clear or reload .oct files, but
that's not the way things currently work.)

Also, I think your code will stop working if someone rewrites the .oct
file as a .m file, but again, it might be possible to work around that
with a smart object instead of a direct function pointer.  I guess
what I'm trying to describe is a kind of feval object that caches the
function pointer in a smart way.

I was hoping to call the computational functions directly rather
than marshalling all the arguments into an octave_value_list.
This is both for speed and convenience.  Making feval easier
to call is a separate issue.

Paul Kienzle
address@hidden



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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