[C++-sig] ubuntu/gcc/gccxml

2010-03-15 Thread Nathan Stewart
I'm trying to use pyplusplus, and I'm running into what appears to be a
really old problem fixed by the gccxml-0.9.0+cvs20080525 patch.

I'm running Ubuntu 9.10, gcc-4.4.1, gccxml 0.9.0+cvs20080525. I'm also a
little confused by the various versions of gccxml out there - the 'official'
site claims 0.6 is the latest. The language-binding.net site refers to
version 0.9. Basically pyplusplus has never worked (out of the box or with
any amount of fiddling) on karmic for me, on any of my machines.

The errors I get are:

Error occured while running GCC-XML: In file included from
/usr/include/fcntl.h:217,...
And lots more errors in fctnl2.h ' __builtin_va_arg_pack_len' not declared
in this scope.

I have tried running GCC-XML w/ gcc-4.2, modifying headers as in some of the
other posts, to no avail.

Is there anyone with a Karmic box that has this working at all?
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] ubuntu/gcc/gccxml

2010-03-15 Thread Roman Yakovenko
On 3/15/10, Nathan Stewart  wrote:
> I'm trying to use pyplusplus, and I'm running into what appears to be a
> really old problem fixed by the gccxml-0.9.0+cvs20080525 patch.
>
> I'm running Ubuntu 9.10, gcc-4.4.1, gccxml 0.9.0+cvs20080525. I'm also a
> little confused by the various versions of gccxml out there - the 'official'
> site claims 0.6 is the latest. The language-binding.net site refers to
> version 0.9.

The latest official GCCXML release was indeed 0.6, since then the only
way to get it is to compile and install from sources.

GCCXML version 0.6 is based on gcc-3.6 ( I could be wrong ), while the
current sources are based on gcc-4.2

> Basically pyplusplus has never worked (out of the box or with
> any amount of fiddling) on karmic for me, on any of my machines.
>
> The errors I get are:
>
> Error occured while running GCC-XML: In file included from
> /usr/include/fcntl.h:217,...
> And lots more errors in fctnl2.h ' __builtin_va_arg_pack_len' not declared
> in this scope.
>
> I have tried running GCC-XML w/ gcc-4.2, modifying headers as in some of the
> other posts, to no avail.

I suggest you to take this problem to gccxml mailing list, with
complete gccxml command line invocation. You can find it in the
output, produced by py++. I am sure you will get the help and the
solution. ( I did and it was really quick ).

> Is there anyone with a Karmic box that has this working at all?

I am using and testing py++ and pygccxml on Ubuntu 9.10 32/64
architectures with gcc-4.4.1 as the default compiler.

pygccxml svn contains compiled gccxml for those architectures (
http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/gccxml_bin/v09/ )
and used for testing.

HTH
-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


[C++-sig] Having problems with returned object.

2010-03-15 Thread Fabzter
Hi everybody, I'll try to describe my problem:

I have this c++ class (simplyfied):

---
class MyClass
{
public:
MyClass()
{
this->setPos(0, 0);
}
MyClass(const MyClass& orig)
{
this->setPos(orig.pos);
}

void setPos(int x, int y)
{
this->pos.clear();
this->pos.push_back(x);
this->pos.push_back(y);
}
void setPos(const std::vector& p)
{
this->pos = p;
}
const std::vector& getPos() const
{
return this->pos;
}
private:
std::vector pos;
};
---

And then, it's wrapped like this:

---
typedef void (MyClass::*setPos_with_int)(int x, int y);
typedef void (MyClass::*setPos_with_vect)(const std::vector& pos);

void export_jugada()
{
class_("MyClass")
.def("setPos", setPosicion_with_int(&MyClass::setPos) )
.def("setPos", setPosicion_with_vect(&MyClass::setPos) )

.def("getPosicion", &MyClass::getPosicion,
return_value_policy())
;
}
---

Now, I have a little script that does something like:

---
...
def get()
m = MyClass()
m.setPos(4, 9)
return m
...
---

I have debugged (as much as my knowledge lets me!!!) to this point and
everything seem fine. "get()" gets properly called, and when it calls
MyClass::setPos(int, int), it seems to do everything fine (filling up
the vector). Well, now, in the main program, after reading the script,
I do something like this:

---
...extracting get() from script...
MyClass m ( getObj() );
---

The problem here is that m ends up having pos = {4, 0}. The second
element from the vector is ALWAYS == 0. While debugging I discovered
that when the returned object is being copied (via copy constructor),
the "pos" member of the origin (the object that came from python) has,
well, it's second element == 0. The same happens if I do something
like:

---
...extracting get() from script...
MyClass m =   getObj() ;
---

Please, help me find my mistakes, I've already spent hours trying to
solve this :(
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig