[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mkoctfile compilation issues/questions
From: |
Charles R. Wright |
Subject: |
mkoctfile compilation issues/questions |
Date: |
Sat, 14 Feb 2004 17:30:22 -0500 |
User-agent: |
KMail/1.4.3 |
Hello,
I'm trying to create a loadable function and I'm using the code attached below
as a proving ground before I get in deep. What I'd like to do is make the
DEFUN_DLD-created function be a wrapper and call another function that does
all the work. I want the work function to return a vector, and have been
experimenting with Octave data types. When I compile the code below, I get a
syntax error that leads me to believe I'm leaving out an #include or
something, but I can't determine what it is. Please help!
Also, please point me to some good examples for using matrices and vectors
within a function. Naturally, I'd like to use the classes provided by Octave.
I've been looking at octave-forge, but haven't come across anything good for
that yet.
Thanks a lot, and thanks for Octave!
Charles Wright
P.S. I'm working on a Vitierbi decoder - looks like octave-forge could use
one. The .m file is dog-slow. I'm hoping the .oct version will be lots
faster!
-----------------------------------------------------------------------------
System info:
Octave 2.1.53, Linux 2.4.22 (RH8)
-----------------------------------------------------------------------------
Here's the error message:
mkoctfile octest.cc
cc1plus: warning: changing search order for system directory
"/usr/local/include"
cc1plus: warning: as it has already been specified as a non-system
directory octest.cc:33: syntax error before `*' token
octest.cc:37: syntax error before `*' token
Compilation exited abnormally with code 1 at Sat Feb 14 13:45:24
The source code:
-------------------------------------------------------------------------
//
// octest.cc
//
// Testing how to write code for dynamically loadable functions
//
// Charles R. Wright
// 2004-02-11
#include <octave/oct.h>
#include <octave/utils.h>
#include <octave/variables.h>
DEFUN_DLD (octest, args, ,
"Cut-and-try function for dynamic loading in Octave")
{
octave_value_list retval;
printf("Number of input args: %d\n", args.length());
octave_value invec = args(0);
printf("Size of input arg 0: %d rows, %d cols\n",
invec.rows(), invec.columns());
Array<double> foo(12,3.0);
for (int k = 0; k < foo.length(); ++k)
{
printf("foo[%d] = %f\n", k, foo.elem(k));
}
return retval;
}
Array *
testFunc()
{
int * foo;
Array * testArray = new Array * [1];
return foo;
}
-------------------------------------------------------
-------------------------------------------------------------
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
-------------------------------------------------------------
- mkoctfile compilation issues/questions,
Charles R. Wright <=