help-octave
[Top][All Lists]
Advanced

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

Re: Running C++ program from octave ??


From: Henry F. Mollet
Subject: Re: Running C++ program from octave ??
Date: Thu, 21 Jul 2005 11:59:29 -0700
User-agent: Microsoft-Entourage/11.1.0.040913

Required to be able to run dynamically linked functions.

It is a two step process. First the .cc source file needs to be compiled
using 'mkoctfile filename' at the shell prompt (not the octave prompt) so
this requires mkoctfile. Second the Octave version has to be able to run the
.oct file which requires octave_config_info ("dld") = 1, not 0.

After compilation one has the files filename.cc, filename.o, and the
filename.oct. Using 'filename' at the octave prompt will use the
filename.oct. 

Now assume you also have a corresponding filename.m. This one was running
too slowly for you and you wanted to speed it up. You therefore created a
.cc source using C or C++ language and then you compiled it. Now in addition
to the .oct file you also have the .m file in the same directory. I believe
octave will use the .oct file rather than the .m file if you type 'filename'
at the octave prompt. One can test this by temporarily renaming on of the
files, so that Octave can no longer find it when called with the old name.
Henry
N.B On my new Octave 2.1.71 installation I could not find the oregonator.cc
nor orgegonator.m examples, so I grabbed the ones on my old computer and am
now testing what I said in previous paragraph.
[/usr/local/share/octave/examples] -bash-2.05b 518$ ls
oregonator.cc   oregonator.m

[/usr/local/share/octave/examples] -bash-2.05b 522$ sudo mkoctfile
oregonator.cc
% sudo because all my directories are locked and I don't know how to obtain
root privilages for all directories and files in one sweep.
Cut

[/usr/local/share/octave/examples] -bash-2.05b 523$ ls
oregonator.cc   oregonator.m    oregonator.o    oregonator.oct




on 7/21/05 11:03 AM, Robert A. Macy at address@hidden wrote:

> Henry,
> 
> Is it good to have...
>>> octave_config_info ("dld")
> ans = 1
> ...??
> 
> Mine gives that answer.
> I'm running the old Win binary 2.1.50
> but alas, I have no .c or .lib or .h to work with
> 
>                - Robert -
> 
> On Thu, 21 Jul 2005 10:42:07 -0700
>  "Henry F. Mollet" <address@hidden> wrote:
>> No need to apologize, I'm the blind man here. I believe
>> there was an answer
>> to your question from Quentin. An answer to my question
>> is still
>> outstanding. It does not work to run the compiled oct
>> file and I don't know
>> why. It should because now I should be able to run
>> dynamically linked
>> function
>> octave:9> octave_config_info ("dld")
>> ans = 1
>> I'll also have to try the oregonator.cc example again in
>> the manual.
>> Henry
>> 
> 
> 
> 
> -------------------------------------------------------------
> 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]