Discussion:
how to wrap a c++ static object
(too old to reply)
Dongxu Ma
2005-09-16 09:34:28 UTC
Permalink
Hi all,

In a c++ class, there is a static object. I'd like to wrap it as a sub in
perlxs. Just like this:

foo *
foo::bar()
CODE:
RETVAL = &(foo::bar);
OUTPUT:
RETVAL

Of course, the RETVAL will be blessed in typemap and finally return a RV in
perl code.
Each time I invoke the sub in perl, it will cause a segfault. But the same
idea works in c++ code.
Does anyone know the reason? Thanks in advance.
--
Bst Rgrs, Dongxu
Reinhard Pagitsch
2005-09-22 08:46:26 UTC
Permalink
Hello,

Do you have a complete example, so I can try it here?
I am not sure what you want todo with this. I made a simple module
containing this example, but on compileing I got an error:
error C2440: '=' : cannot convert from 'TestEN *(__thiscall TestEN::*
)(void)' to 'TestEN *' There is no context in which this conversion is
possible
I am using "Microsoft Visual C++ Toolkit 2003".

regards
Reinhard
Post by Dongxu Ma
Hi all,
In a c++ class, there is a static object. I'd like to wrap it as a sub
foo *
foo::bar()
RETVAL = &(foo::bar);
RETVAL
Of course, the RETVAL will be blessed in typemap and finally return a RV
in perl code.
Each time I invoke the sub in perl, it will cause a segfault. But the
same idea works in c++ code.
Does anyone know the reason? Thanks in advance.
--
Bst Rgrs, Dongxu
Continue reading on narkive:
Loading...