(original) (raw)
Hi everyone,
The messages below are from quite a bit ago. I didn’t respond then because the unit tests weren’t passing for me, and I wanted to try and make them pass…. But then I got pulled off on another project. I’ve recently had some time to work on this again, and I got all the tests involving annotations to work (there’s still a couple tests that don’t pass, involving get\_simple\_map, but they don’t look super-vital).
I finally got my pure virtual class wrapped and compiled, and it is instantiatable and seems to work, but one of my functions is missing. Here’s the code:
class pure\_virtual\_class
{
public:
// -#- @foobaz(transfer\_ownership=true, direction=out) -#-
virtual int get\_value(int\* foobaz) = 0;
virtual int set\_value(int foobaz);
// -#- @return(caller\_owns\_return=true) -#-
static pure\_virtual\_class\* Create();
virtual \~pure\_virtual\_class() {};
}
class non\_virtual\_class : public pure\_virtual\_class
{
public:
non\_virtual\_class();
\~non\_virtual\_class();
// -#- @foobaz(transfer\_ownership=true, direction=out) -#-
int get\_value(int\* foobaz);
int set\_value(int foobaz);
private:
int internal\_state;
int utility\_function(int foobaz);
}
And the Create method does this:
pure\_virtual\_class\* pure\_virtual\_class::Create()
{
return static\_cast<pure\_virtual\_class\*>(new non\_virtual\_class());
}
So, I got rid of all the gccxml warnings on the code (except for the one indicating that the class pure\_virtual\_class was pure virtual…), and it compiles just fine, and the Create function even works… but the get\_value function doesn’t appear when I dir the class. Set\_value appears and seems to work, so why not get? Any ideas?
I’m on a clean Debian Etch install (virtual machine), using GCC 4.3.2, Python 2.5.2, gccxml 0.9\.
Thanks,
Ben Fitzpatrick
From:
cplusplus-sig-bounces+bfitzpatrick=vtiinstruments.com@python.org
\[mailto:cplusplus-sig-bounces+bfitzpatrick=vtiinstruments.com@python.org\] On
Behalf Of Gustavo Carneiro
Sent: Tuesday, June 23, 2009 6:52 PM
To: Development of Python/C++ integration
Subject: Re: \[C++-sig\] Pybindgen/pygccxml integration
2009/6/23 Ben Fitzpatrick <bfitzpatrick@vtiinstruments.com>
Gustavo Carneiro wrote:
2009/6/23 Ben Fitzpatrick <bfitzpatrick@vtiinstruments.com <mailto:bfitzpatrick@vtiinstruments.com>>
Thanks for the suggestions!
I tried the first one, just as a test. I'd like to do the second
programatically if I can, but I just wanted to make sure
annotations were going to fix this. It still seems to be giving me
the same error:
(...)/pure\_virtual.h:5: WrapperWarning: Parameter 'int \* value'
error (used in int pure\_virtual\_class::get\_value(int \* value)
\[member function\]):
<pybindgen.typehandlers.base.TypeConfigurationError instance at
0xb780326c>
virtual int get\_value(int\* value) = 0;
Here is what I changed my code to:
// -#- @value(transfer\_ownership=true) -#-
virtual int get\_value(int\* value)=0;
Apart from the blank line, seems OK. Do you get a "unused
annotation" warning?
That's odd, there wasn't a blank line in my original email.
There certainly isn't one in the file.
I do not get an unused annotation warning, or anything to suggest it noticed my
annotation in the slightest. I am using Python2.4 on Debian Etch, with Pygccxml
0.9.5\. The Python's a bit old, but everything else has been compiled or
installed manually.
Well, with Python 2.5 it prints TypeConfigurationError('some message'), which
is rather more helpful. You are not seeing the full error message, just
the (vague) exception type.
And did you run the unit tests (./waf check) ? If the unit tests pass,
annotations supposedly are working...
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
\--
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert