help-octave
[Top][All Lists]
Advanced

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

Swig and Mkoctfile not working


From: dynamphorous
Subject: Swig and Mkoctfile not working
Date: Mon, 9 May 2011 09:04:54 -0700 (PDT)

I posted about this over at 
http://stackoverflow.com/questions/5887494/using-swig-to-create-octave-file
StackOverflow , but I figured this forum may fit better with the people I am
hoping to have see my question. I included the link above to my other post
for the sake of completeness. Thank you in advance to whoever takes their
time to read and respond to this question. 

Essentially when I try to follow the documentation for mkoctfile and swig
for Octave, I get lots of errors, even for the most basic script.

So my swig_test.c 

int fact(int n) {
  if (n <= 1) return 1;
    else return 2;
}

int my_mod(int x, int y) {
       return (x%y);
}

and swig_test.i

%module swig_test
%{
extern int fact(int n);
extern int my_mod(int x, int y);
%}

extern int fact(int n);
extern int my_mod(int x, int y);

Now when I try to run swig, the instructions in their documentation say to
use the command: 

 swig -octave swig_test.i -o swig_test_wrap.cxx

Now this wont work for two reasons, firstly, swig_test_wrap.cxx wont be
accepted by mkoctfile since it only takes .C .cc and .cpp files. Secondly
the order has to be rearranged so the -o option is given before the
swig_test.i file. Like so:

 swig -octave -o swig_test_wrap.cpp swig_test.i

(I also took the liberty of updating the output to the right file type). Now
that is all well and good, and I have what looks like it should work for
mkoctfile. But the command:
  
  mkoctfile swig_test_wrap.cpp swig_test.c

returns the following errors:

swig_test_wrap.cpp:1449:24: error: invalid covariant return type for
'virtual Octave_map octave_swig_type::map_value() const'
/usr/include/octave-3.4.0/octave/../octave/ov-base.h:560:22: error:  
overriding 'virtual octave_map octave_base_value::map_value() const'
swig_test_wrap.cpp:1657:24: error: invalid covariant return type for
'virtual Octave_map octave_swig_ref::map_value() const'
/usr/include/octave-3.4.0/octave/../octave/ov-base.h:560:22: error:  
overriding 'virtual octave_map octave_base_value::map_value() const'

This is SUCH a simple example, I figure there must be something wrong here
that I'm not understanding. If someone who has had experience with this can
possibly help, I would greatly appreciate it!

--
View this message in context: 
http://octave.1599824.n4.nabble.com/Swig-and-Mkoctfile-not-working-tp3509662p3509662.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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