help-octave
[Top][All Lists]
Advanced

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

Re: Can Octave (Matlab code) be added to C++ as a library?


From: Kai Torben Ohlhus
Subject: Re: Can Octave (Matlab code) be added to C++ as a library?
Date: Wed, 8 Apr 2020 14:48:00 +0900
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

On 4/8/20 6:40 AM, evansste wrote:
> The link, about standalone programs, mentions that Octave has an archived
> library file called "liboctave.a".  Where would I find this file?  Here's
> that link, which was posted earlier by siko1056:
> 
> https://octave.org/doc/v5.2.0/Standalone-Programs.html 
> 
> I've written programs in Fortran, and would like to use "ismember" and
> "unique", which are native Octave functions, in my Fortran programs.  I
> already have many of my own Fortran programs stored in an archive file. 
> Could I just include the "liboctave.a" file, along with my own archive file,
> and be able to use Octave's native functions?
> 
> For example, this is how I currently compile a Fortran program so that I may
> use my own Fortran functions in the program:
> 
> caf <fortran_source_file.f08> -o <executable_name_of_source_file>
> fortranlib.a
> 
> If I want to also include Octave's functions would I simply do something
> like:
> 
> caf <fortran_source_file.f08> -o <executable_name_of_source_file>
> fortranlib.a liboctave.a
> 
> I'd love to use native Octave functions in my Fortran programs since doing
> so would prevent me from having to re-write those functions in Fortran. 
> Would this work, and where might I find the "liboctave.a" file?
> 
> Thanks so much for your time.
> 


By default Octave is build without static libraries, thus all major
Linux distributions do not provide these files by default either.  One
possibility is to compile Octave yourself using

  ./configure --enable-static

Another way is to link the dynamic Octave libraries.  I don't have
OpenCoarrays to test, but maybe this one might work:

  caf <fortran_source_file.f08> -o <executable_name_of_source_file>
  fortranlib.a -L/path/to/liboctave -loctave

HTH,
Kai



reply via email to

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