help-octave
[Top][All Lists]
Advanced

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

Re: C++ dynamically linked functions


From: Paul Kienzle
Subject: Re: C++ dynamically linked functions
Date: Wed, 10 Apr 2002 14:21:53 -0400

Try

extern "C" {
   int myfunc();
}

On Wed, Apr 10, 2002 at 02:05:26PM -0400, Kiran Kumar Sagi wrote:
> 
> Hi,
> 
>  I am trying to call a C function from the oregonator.cc
>  to get started with using C libraries in octave.
> 
>  first i tried,
>   mkoctfile oregonator.cc myfunc.c
>   copied the oregonator.oct file into octave bin directory.
>   on using it, it breaks saying myfunc: reference symbol not found.
> 
>  next i tried creating static library from myfunc.o and tried
>   mkoctfile oregonator.cc -lmyf
>   it still doesnt solve the probelm.
> 
>  could you please let me know what i am missing here?
> 
>  The below is the sample oregonator.cc file.
> 
> Thanks,
> kiran
> 
> #include <oct.h>
> 
> int myfunc();
> 
> DEFUN_DLD (oregonator, args, ,
>   "The `oregonator'.\n\
> \n\
> Reference:\n\
> \n\
>   Oscillations in chemical systems.  IV.  Limit cycle behavior in a\n\
>   model of a real chemical reaction. Richard J. Field and Richard\n\
>   M. Noyes, The Journal of Chemical Physics, Volume 60 Number 5,\n\
>   March 1974.")
> {
>   int i;
>   ColumnVector dx (3);
> 
>   ColumnVector x = args(0).vector_value ();
> 
>   dx(0) = 77.27 * (x(1) - x(0)*x(1) + x(0) - 8.375e-06*pow (x(0), 2));
>   dx(1) = (x(2) - x(0)*x(1) - x(1)) / 77.27;
>   dx(2) = 0.161*(x(0) - x(2));
>   i = myfunc();
>   printf("i %d\n",i);
>   return octave_value (dx);
> }
> 
> 
> 
> 
> -------------------------------------------------------------
> 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
> -------------------------------------------------------------
> 



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