help-octave
[Top][All Lists]
Advanced

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

Re: Use package in standalone programs


From: siko1056
Subject: Re: Use package in standalone programs
Date: Mon, 8 Jan 2018 06:28:23 -0700 (MST)

Zoltán Szabó wrote
> I am trying to create a small c++ application to execute an octave m file.
> 
> So this will be a standalone program as mentioned here:
> https://www.gnu.org/software/octave/doc/v4.0.3/Standalone-Programs.html#Standalone-Programs
> 
> My m file is using some functions from the signal package. Is it possible
> to load a package from a standalone program when using octave as a
> library?
> 
> Thanks

For the current Octave development version 4.3.0+ it is possible. Do you
need version 4.0.3 or the current stable version 4.2.1? There it seems to
make some trouble.

Using the current Octave development version 4.3.0+ and the interval package
as example:

```
pkg load interval
infsup (1, 2)
   ans = [1, 2]
```

Extending [1] as a start, the above would translate to:

```
octave::feval ("pkg", ovl ("load", "interval"), 0);
octave_value_list out = octave::feval ("infsup", ovl (1, 2), 1);

if (out.length () > 0)
  octave::feval ("disp", out(0), 0);
```

Compiled with:

mkoctfile --link-stand-alone embedded.cc -o embedded

HTH,
Kai

[1]
https://hg.savannah.gnu.org/hgweb/octave/file/cd42d0f341db/examples/code/embedded.cc



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

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