[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
accessing user-defined types from C++
From: |
pkienzle |
Subject: |
accessing user-defined types from C++ |
Date: |
Fri, 21 Nov 2003 00:00:19 -0000 |
While we are on the topic of the type system, I've been
playing with methods for accessing sparse types from
functions outside sparse.oct.
Curiously enough, if I define the two oct-files:
hello.cc:
======
#include <octave/oct.h>
void world(void)
{
octave_stdout << "world" << std::endl;
}
DEFUN_DLD(hello,args,nargout,"hello")
{
octave_stdout << "hello" << std::endl;
return octave_value_list();
}
world.cc:
=======
#include <octave/oct.h>
DEFUN_DLD(world,args,nargout,"world")
{
void world(void);
world();
return octave_value_list();
}
everything works as expected:
octave:1> hello
hello
octave:2> world
world
Things won't be quite so easy on windows methinks
because I will need to link world.oct directly against
hello.oct. I haven't tried that yet, but it will certainly
complicate the build system for octave-forge.
Anyone have a better how I can write an independent DLD
function which accesses data from the sparse type?
Right now the built-in types occupy a privileged place
by virtue of having methods in the octave_value base
class to access them.
BTW, octave 2.1.51 fails on Linux if I do things in the
other order, crashing octave in the process:
octave:1> world
octave: relocation error:
/home/pkienzle/prog/octave/crosslink/world.oct: undefined symbol:
_Z5worldv
[crosslink]#
Paul Kienzle
address@hidden
Re: restructuring load-save, David Bateman, 2003/11/21