[C++-sig] [Py++] RuntimeError: Py++
is going to write different content to the same file (original) (raw)
Roman Yakovenko roman.yakovenko at gmail.com
Fri Aug 7 20:05:16 CEST 2009
- Previous message: [C++-sig] [Py++] RuntimeError: `Py++` is going to write different content to the same file
- Next message: [C++-sig] How to correctly expose back shared_ptr-ed Python object to C++
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Aug 7, 2009 at 12:27 PM, Razvan Yorik<razvan_76 at ymail.com> wrote:
Hello, I have a problem wrapping the following header file using Py++. The class "Derived" defines a local typedef "Helper" which has different meanings for each template parameter "T". Wrapped header: ---------- test.h ---------- #ifndef TESTH #define TESTH template class Base{ public: }; template class Derived: public Base{ public: typedef Base Helper; }; This leads to the error (full output log at the end of this email): RuntimeError:
Py++
is going to write different content to the same file(split/Helper.pypp.hpp). The following is a short list of possible explanations for this behaviour: *Py++
bug, in this case, please report it * modulebuildert contains two or more classes with the same alias * modulebuildert contains two or more classes with the same wrapper alias Please carefully reviewPy++
warning messages. It should contain an additional information. I tried to rename or exclude the "Helper" class from the wrapper, but the problem is, that it is not even in mb.classes():
This is because "Helper" is an alias. "Base" is illegal Python identifier, so Py++ has to build a legal one for you class. In this case it found that you call your class "Helper" and choose it as the alias
print [c.name for c in mb.classes()] ['Derived', 'Derived', 'Base', 'Base']
for cls in mb.classes(): print "full name: %s, alias: %s" % ( cls.decl_string, cls.alias )
Is there a possibility to - rename the different Helpers to "HelperInt" and "HelperFloat" in the code generator
for cls in mb.classes(): cls.alias = 'helper_' + cls.split( '<' )[1].split('>' )[0]
or
- apply minor changes to the header only for GCCXML, but without changing the classes (they are simplified from a bigger project!) - or to exclude the Helper class?
I suggest you to take a look on Py++ example. You will find the very useful.
HTH
-- Roman Yakovenko C++ Python language binding http://www.language-binding.net/
- Previous message: [C++-sig] [Py++] RuntimeError: `Py++` is going to write different content to the same file
- Next message: [C++-sig] How to correctly expose back shared_ptr-ed Python object to C++
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]