On 10/10/06, Allen Bierbaum <al...@vr...> wrote:
> I just read this document and although it describes what is causing Py++
> to generate the code I am not sure it answers the issues I am having:
>
> 1. Only the last method wrapped is able to be called from python, so why
> wrap the others?
I don't understand what do you mean by the first one and by the last one.
I am able to call all exposed methods
> 2. I think I see what you are getting at in the solution section about
> renaming the methods automatically, but this only exposes the ones that
> are called in the header files that gccxml is compiling.
The better way to say this: this is exposes only method that were instantiated.
> In my case
> (and I think probably in most cases where this will come up), I want to
> create "get_value" methods for many more types then gccxml actually
> saw. Is there any way to know of to force these methods to be
> instantiated similar to what we do with class templates?
Just use similar technique and it will work. You also can add code for every
instantiated class
cls.add_declaration_code( '"get_value_x", &environment_t::get_value< x >' )
> 3. Why do I have to change the function name to demangled name
I think that the document explain this. What you did not understand?
I will try to improve the document. Even in C++ you have to use
x.get_value< y > syntax.
>, can't I
> just change the alias to what I want the method to appear as and rely
> upon Py++ to use casts to get the correct method?
No, because you will use C style cast on unrelated types. I don't
know whether it will work or not. Anyway this is a wrong way to go.
> (at least with gcc 4
> I get compiler errors trying to do the equivalent of your correct code
> and get "&::environment_t::get_value<std::string>".
Just committed the unit test and all works as expected. I am using
gcc 4.0.3. What is the error you get?
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|