help-octave
[Top][All Lists]
Advanced

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

Re: Simple oct function


From: Iago Mosqueira
Subject: Re: Simple oct function
Date: Thu, 8 Aug 2002 17:52:28 +0100

OK, thanks to John Eaton and Andrei Romanenko the function looks like this,
but although it compiles fine, when I call it from octave I get a relocation
error: udefined symbol in addone_ and octave crashes.

Any idea?

Many thanks

iago

>
> #include <octave/config.h>
> #include <octave/oct.h>
>
> extern "C" int F77_FUNC (addone, ADDONE) (const int&, int&);
>
> DEFUN_DLD (addone, args, ,
>   "y = addone (x)")
> {
>   octave_value retval;
>
>   int nargin = args.length ();
>
>   if (nargin == 1)
>     {
>       int x = args(0).int_value ();
>
>       if (! error_state)
>         {
>           int result;
>           F77_FUNC (addone, ADDONE) (x, result);
>           retval = static_cast<double> (result);
>         }
>       else
>         error ("addone: expecting integer argument");
>     }
>   else
>     print_usage ("addone");
>
>  return retval;
> }




-------------------------------------------------------------
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]