help-octave
[Top][All Lists]
Advanced

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

help for .oct files


From: John W. Eaton
Subject: help for .oct files
Date: Wed, 18 Feb 1998 14:20:28 -0600

On 18-Feb-1998, Stef Pillaert <address@hidden> wrote:

| I have a little problem writing .oct-files.
| 
| In a function I'm writing (function1.cc), I want to use the function "find".
| 
| I tried to do this, using something like:
| "  extern octave_value_list Ffind (const octave_value_list&, int);"
| 
| It compiles OK (just doing "mkoctfile function1.cc"), but when calling
| this, I get a message like:
| "octave: can't resolve symbol 'Ffind__FRC17octave_value_listi'"

It's failing because the dynamic loader doesn't know where to find Ffind.

| On the other hand, this works fine with the function "eval" (in stead of
| "find").

It works with eval because Feval is built in to the interpreter, so
the dynamic loader knows where to find it.

Here's another approach.  It has the advantage of working whether the
function you want to call is a built-in function, defined from a .oct
file, or defined from a .m file:

  #include <octave/oct.h>

  extern octave_value_list Ffeval (const octave_value_list&, int);

  DEFUN_DLD (xfind, args, nargout,
    "")
  {
    // Create an argument list that's appropriate for Ffeval.  The
    // name of the function goes in the first element, the other args
    // follow.

    octave_value_list find_args;
    int n = args.length ();
    for (int i = n; i > 0; i--)
      find_args(i) = args(i-1);
    find_args(0) = "find";

    return Ffeval (find_args, nargout);
  }

Since this is a bit inconvenient, look for a function

  feval (const string& name, const octave_value_list&, int);

in future releases that will eliminate the need for stuffing the
function name in the same list as the actual args.

Thanks,

jwe



reply via email to

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