pygccxml-development Mailing List for C++ Python language bindings (Page 10)
Brought to you by:
mbaas,
roman_yakovenko
You can subscribe to this list here.
2006 |
Jan
|
Feb
(6) |
Mar
(160) |
Apr
(96) |
May
(152) |
Jun
(72) |
Jul
(99) |
Aug
(189) |
Sep
(161) |
Oct
(110) |
Nov
(9) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(13) |
Feb
(48) |
Mar
(35) |
Apr
(7) |
May
(37) |
Jun
(8) |
Jul
(15) |
Aug
(8) |
Sep
(2) |
Oct
(1) |
Nov
(2) |
Dec
(38) |
2008 |
Jan
(11) |
Feb
(29) |
Mar
(17) |
Apr
(3) |
May
|
Jun
(64) |
Jul
(49) |
Aug
(51) |
Sep
(18) |
Oct
(22) |
Nov
(9) |
Dec
(9) |
2009 |
Jan
(28) |
Feb
(15) |
Mar
(2) |
Apr
(11) |
May
(6) |
Jun
(2) |
Jul
(3) |
Aug
(34) |
Sep
(5) |
Oct
(7) |
Nov
(13) |
Dec
(14) |
2010 |
Jan
(39) |
Feb
(3) |
Mar
(3) |
Apr
(14) |
May
(11) |
Jun
(8) |
Jul
(9) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
(7) |
Apr
|
May
|
Jun
(3) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2016 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2021 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
From: Maik B. <bec...@go...> - 2009-01-30 19:54:05
|
Roman Yakovenko schrieb am Friday 30 January 2009 um 20:39: > > http://www.nabble.com/-C%2B%2B-sig--Raoul-Gough%27s-container-suite-with-sv >n-boost-trunk-boost.python--td13152941.html I found this as well after I've send the email. So I altered slice_handler.hpp (patch attached) and ran update_code_repository.py It works. > The work around is to define BOOST_PYTHON_NO_PY_SIGNATURES > > gcc -DBOOST_PYTHON_NO_PY_SIGNATURES other args Thank you! Best, -- Maik |
From: Roman Y. <rom...@gm...> - 2009-01-30 19:39:25
|
On Fri, Jan 30, 2009 at 7:22 PM, Maik Beckmann <bec...@go...> wrote: > Hello, > > I like to use the indexing_suite_v2 as provided by py++. > > As an example I did > {{{ > #include <vector> > void foo(std::vector<double> a) { } > }}} > and told module_builder_t to use v2 > {{{ > mb = module_builder.module_builder_t( > ... > , indexing_suite_version=2) > }}} > > This is what py++ generated for me > - http://pastebin.ca/1322914 > > But compiling via > $ LC_ALL=C g++ -c pyWrapper.cpp -I . -I /usr/include/python2.6/ 2>&1|tee log > gives error message > - http://pastebin.ca/1322912 > which contains > error: no class template named 'extract_return_type' > > How to do it right? http://www.nabble.com/-C%2B%2B-sig--Raoul-Gough%27s-container-suite-with-svn-boost-trunk-boost.python--td13152941.html The work around is to define BOOST_PYTHON_NO_PY_SIGNATURES gcc -DBOOST_PYTHON_NO_PY_SIGNATURES other args -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Maik B. <bec...@go...> - 2009-01-30 17:21:09
|
Hello, I like to use the indexing_suite_v2 as provided by py++. As an example I did {{{ #include <vector> void foo(std::vector<double> a) { } }}} and told module_builder_t to use v2 {{{ mb = module_builder.module_builder_t( ... , indexing_suite_version=2) }}} This is what py++ generated for me - http://pastebin.ca/1322914 But compiling via $ LC_ALL=C g++ -c pyWrapper.cpp -I . -I /usr/include/python2.6/ 2>&1|tee log gives error message - http://pastebin.ca/1322912 which contains error: no class template named 'extract_return_type' How to do it right? Thanks, -- Maik PS: $ pacman -Qs boost$ local/boost 1.37.0-1 $ pacman -Qs pyplusplus-svn$ local/pyplusplus-svn 1635-1 |
From: Roman Y. <rom...@gm...> - 2009-01-25 19:14:53
|
On Sun, Jan 25, 2009 at 4:24 PM, Sergey . <sr...@gm...> wrote: > On Sun, Jan 25, 2009 at 1:27 AM, Roman Yakovenko <rom...@gm...> > wrote: >> I guess nothing, but to be sure I need to see how you construct >> module_builder_t class instance. >> Do you pass single file a list of files? My guess - you pass list of >> files. > - Yes, this is correct, I pass list of files. > >> I suggest you to create a header file, which includes all others and >> pass it to module_builder_t.__init__. This should fix your problem. > - Good idea, I will try that soon. I will let you know how it goes. I > will have to contact my boss before I can send you any files, but I guess > this should be OK. I don't need your code, but a code that reproduce the problem. It could be nice, if you can send very simple code. > Thank you for your help! You are welcome. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Sergey . <sr...@gm...> - 2009-01-25 14:24:24
|
On Sun, Jan 25, 2009 at 1:27 AM, Roman Yakovenko <rom...@gm...>wrote: > I guess nothing, but to be sure I need to see how you construct > module_builder_t class instance. > Do you pass single file a list of files? My guess - you pass list of files. - Yes, this is correct, I pass list of files. > I suggest you to create a header file, which includes all others and > pass it to module_builder_t.__init__. This should fix your problem. - Good idea, I will try that soon. I will let you know how it goes. I will have to contact my boss before I can send you any files, but I guess this should be OK. Thank you for your help! Sergey. On Sun, Jan 25, 2009 at 1:27 AM, Roman Yakovenko <rom...@gm...>wrote: > On Sat, Jan 24, 2009 at 4:35 PM, Sergey . <sr...@gm...> wrote: > > Dear Py++ developers, > > > > I am using Pygccxml and Py++ to generate Python bindings for our C++ > > project and really like it. You guys are doing a great job, thank you for > > you work! > > Thank you! > > > After upgrading to version 1.0.0 I started to occasionally receive the > > following error when trying to execute module_builder_t (see log below). > > Strange thing is that it appears only with certain combination of headers > > files, when each of them separately could be bound without a problem. > Also, > > trying to compile with older version of gcc (3.4.6) tends to produce this > > error for almost any combination of header files. Any idea what could be > > wrong with my setup or my code? > > I guess nothing, but to be sure I need to see how you construct > module_builder_t class instance. > Do you pass single file a list of files? My guess - you pass list of files. > I suggest you to create a header file, which includes all others and > pass it to module_builder_t.__init__. This should fix your problem. > > If it does, it could be nice if you can send me (privately) gccxml > generated files for every file, you pass to module_builder_t and than > xml file of the file, which includes all. > I think this will help me to find and fix the bug. > > Thanks > > -- > Roman Yakovenko > C++ Python language binding > http://www.language-binding.net/ > |
From: Roman Y. <rom...@gm...> - 2009-01-25 06:27:16
|
On Sat, Jan 24, 2009 at 4:35 PM, Sergey . <sr...@gm...> wrote: > Dear Py++ developers, > > I am using Pygccxml and Py++ to generate Python bindings for our C++ > project and really like it. You guys are doing a great job, thank you for > you work! Thank you! > After upgrading to version 1.0.0 I started to occasionally receive the > following error when trying to execute module_builder_t (see log below). > Strange thing is that it appears only with certain combination of headers > files, when each of them separately could be bound without a problem. Also, > trying to compile with older version of gcc (3.4.6) tends to produce this > error for almost any combination of header files. Any idea what could be > wrong with my setup or my code? I guess nothing, but to be sure I need to see how you construct module_builder_t class instance. Do you pass single file a list of files? My guess - you pass list of files. I suggest you to create a header file, which includes all others and pass it to module_builder_t.__init__. This should fix your problem. If it does, it could be nice if you can send me (privately) gccxml generated files for every file, you pass to module_builder_t and than xml file of the file, which includes all. I think this will help me to find and fix the bug. Thanks -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Sergey . <sr...@gm...> - 2009-01-24 14:35:48
|
Dear Py++ developers, I am using Pygccxml and Py++ to generate Python bindings for our C++ project and really like it. You guys are doing a great job, thank you for you work! After upgrading to version 1.0.0 I started to occasionally receive the following error when trying to execute module_builder_t (see log below). Strange thing is that it appears only with certain combination of headers files, when each of them separately could be bound without a problem. Also, trying to compile with older version of gcc (3.4.6) tends to produce this error for almost any combination of header files. Any idea what could be wrong with my setup or my code? Thank you in advance, Sergey. File "/Users/.../lib/python2.5/site-packages/pyplusplus/module_builder/boost_python_builder.py", line 88, in __init__ , indexing_suite_version) File "/Users/.../lib/python2.5/site-packages/pyplusplus/module_builder/boost_python_builder.py", line 130, in __parse_declarations decls = reader.read_files( files, compilation_mode ) File "/Users/.../lib/python2.5/site-packages/pygccxml/parser/project_reader.py", line 225, in read_files return self.__parse_file_by_file(files) File "/Users/.../lib/python2.5/site-packages/pygccxml/parser/project_reader.py", line 280, in __parse_file_by_file leaved_classes = self._join_class_hierarchy( answer ) File "/Users/.../lib/python2.5/site-packages/pygccxml/parser/project_reader.py", line 413, in _join_class_hierarchy leaved_base = leaved_classes[ create_key( base_info.related_class ) ] KeyError: (('/usr/include/c++/4.0.0/bits/stringfwd.h', 49), ('::', 'std', 'allocator<char>')) |
From: Roman Y. <rom...@gm...> - 2009-01-21 06:48:38
|
On Tue, Jan 20, 2009 at 11:56 PM, Gustavo Carneiro <gjc...@gm...> wrote: > I still don't understand one thing. As far as I know, there is no standard > C++ ABI, and no standard calling convention for C++ methods, no standard > layout for class vtable; all those things are compiler dependent. So, if > your code works with MSVC, it may not work with GCC, or vice-versa. Am I > wrong? No, you are right. I can continue the list: different version of the same compiler, memory management, exceptions and etc. * calling conventions - there is a lot of documentation, that explains it, so it should be possible * ABI - name mangling is different, but this problem is solved. Today pygccxml is able to read exported symbols from the .dll, .map or .so file and map it to the declaration. * vtable - reverse engineering should work. I believe that in simple case ( class A{}; class B : A{}, class C : B{} ) it should not be too difficult to reconstruct vtable. * ctypes will have to deal with different compilers and operating system * exceptions - it is possible to solve the problem on Windows, not sure about Linux * memory management is the complex and hard-to-solve issue > Not trying to put down your excellent work. The whole credit should go to Thomas Heller. > I am just trying to understand the limitations (which may or not matter). I understand. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2009-01-21 06:42:56
|
On Tue, Jan 20, 2009 at 11:56 PM, Gustavo Carneiro <gjc...@gm...> wrote: > I still don't understand one thing. As far as I know, there is no standard > C++ ABI, and no standard calling convention for C++ methods, no standard > layout for class vtable; all those things are compiler dependent. So, if > your code works with MSVC, it may not work with GCC, or vice-versa. Am I > wrong? No, you are right. I can continue the list: different version of the same compiler, memory management, exceptions and etc. * calling conventions - there is a lot of documentation, that explains it, so it should be possible * ABI - name mangling is different, but this problem is solved. Today pygccxml is able to read exported symbols from the .dll, .map or .so file and map it to the declaration. * vtable - reverse engineering should work. I believe that in simple case ( class A{}; class B : A{}, class C : B{} ) it should not be too difficult to reconstruct vtable. * ctypes will have to deal with different compilers and operating system * exceptions - it is possible to solve the problem on Windows, not sure about Linux * memory management is the complex and hard-to-solve issue > Not trying to put down your excellent work. The whole credit should go to Thomas Heller. > I am just trying to understand the limitations (which may or not matter). I understand. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Gustavo C. <gjc...@gm...> - 2009-01-20 23:00:34
|
2009/1/20 Roman Yakovenko <rom...@gm...> > On Tue, Jan 20, 2009 at 9:22 PM, Gustavo Carneiro <gjc...@gm...> > wrote: > > This is potentially very useful! Generated Python code can be shipped > with > > any project and is (almost) platform independent without need for > > compilation; you just run Python code. > > This is my goal :-) > > > However I have to wonder how (if) do you support C++ calling conventions. > > I think, I was not clear. You can compile C code using C and/or C++ > compiler. Py++ supports both modes. In the second mode the calling > convention is same as in C, but name mangling is different > > > Things like: > > - How to pass the 'this' parameter to call methods; > > - Function/method overloading. > > > > I have followed the path of C++ code generation precisely because of the > > difficulty of calling C++ code via libffi, or else I would probably have > > contributed to the gobject-introspection and pybank projects. I thought > > ctypes did not support C++? > > Just read few mails, with ctypes-cpp in the subject: > http://sourceforge.net/mailarchive/forum.php?forum_name=ctypes-users > > and take a look on easybmp example( > > http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/examples/pyeasybmp_dev/ctypes/ > ) > I still don't understand one thing. As far as I know, there is no standard C++ ABI, and no standard calling convention for C++ methods, no standard layout for class vtable; all those things are compiler dependent. So, if your code works with MSVC, it may not work with GCC, or vice-versa. Am I wrong? Not trying to put down your excellent work. I am just trying to understand the limitations (which may or not matter). Thanks in advance, -- Gustavo J. A. M. Carneiro INESC Porto, Telecommunications and Multimedia Unit "The universe is always one step beyond logic." -- Frank Herbert |
From: Roman Y. <rom...@gm...> - 2009-01-20 20:08:49
|
On Tue, Jan 20, 2009 at 9:22 PM, Gustavo Carneiro <gjc...@gm...> wrote: > This is potentially very useful! Generated Python code can be shipped with > any project and is (almost) platform independent without need for > compilation; you just run Python code. This is my goal :-) > However I have to wonder how (if) do you support C++ calling conventions. I think, I was not clear. You can compile C code using C and/or C++ compiler. Py++ supports both modes. In the second mode the calling convention is same as in C, but name mangling is different > Things like: > - How to pass the 'this' parameter to call methods; > - Function/method overloading. > > I have followed the path of C++ code generation precisely because of the > difficulty of calling C++ code via libffi, or else I would probably have > contributed to the gobject-introspection and pybank projects. I thought > ctypes did not support C++? Just read few mails, with ctypes-cpp in the subject: http://sourceforge.net/mailarchive/forum.php?forum_name=ctypes-users and take a look on easybmp example( http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/examples/pyeasybmp_dev/ctypes/ ) -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Gustavo C. <gjc...@gm...> - 2009-01-20 19:23:06
|
2009/1/20 Roman Yakovenko <rom...@gm...> > Hello. > > I would like to announce a new code generator for ctypes package. > > The new code generator is integrated with Py++ package and reuse most > of its infrastructure: > * GCC-XML - generates an XML description of a C++ program from GCC's > internal representation > * pygccxml - powerful and simple Python package to work GCCXML generated > file. > * Py++ design, code and utilities > * It was build with future ( ctypes-cpp ) functionality in mind. > * It has cross-platform ( Windows XP and Linux Ubuntu 8.10 ) unit tests > > How it works: > > 1. Using pygccxml, the source files are parsed ( using pygccxml ) and > in-memory description of the code is created > 2. .dll, .map or .so file is parsed ( pygccxml ) and exported symbols > list is created > 3. Using decorated and undecorated names, mapping between declarations > and exported symbols is created. > 4. The exported symbols and the mapping are used to: > * define for what declarations the code should be generated > * find out function calling convention > 5. The last step - the code is generated > > Supported functionality: > > * shared libraries, that were compiled using C or C++ compiler > * free functions, including variable number of arguments > * [global|member] [named|anonymous] variables > * [named|anonymous|opaque|nested] structures > * enumerations > * typedefs > > Examples: > > Is it useful? - Yes. I created example, which generates code for > GMP( http://gmplib.org/ ) library. The following link ( > > http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/examples/gmplib_dev/ > ) will take you to the example. > * dev - directory, which contains code generator source code > * pygmplib - directory, which contains generated code - Python > package, which provides access to GMP lib functionality > * test.py - Python script - tester. > > Want to try? > Windows users: > http://sourceforge.net/project/showfiles.php?group_id=118209 > contains few packages > * ctypes code generator - stand alone executable, which > generates code for a .dll file > * gccxml-setup - gccxml setup file > Linux users: > Sorry, no binaries :-( > * you need to check-out( http://gccxml.org/HTML/Download.html > ) and build gccxml ( http://gccxml.org/HTML/Install.html ) > * you need to check-out Py++ and pygccxml ( > http://sourceforge.net/svn/?group_id=118209 ) > * wrap_library.py ( > http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/scripts/ > ) is the script, which generates code for .so file. > > Your feedback is welcome. This is potentially very useful! Generated Python code can be shipped with any project and is (almost) platform independent without need for compilation; you just run Python code. However I have to wonder how (if) do you support C++ calling conventions. Things like: - How to pass the 'this' parameter to call methods; - Function/method overloading. I have followed the path of C++ code generation precisely because of the difficulty of calling C++ code via libffi, or else I would probably have contributed to the gobject-introspection and pybank projects. I thought ctypes did not support C++? Cheers, -- Gustavo J. A. M. Carneiro INESC Porto, Telecommunications and Multimedia Unit "The universe is always one step beyond logic." -- Frank Herbert |
From: Roman Y. <rom...@gm...> - 2009-01-20 19:10:40
|
Hello. I would like to announce a new code generator for ctypes package. The new code generator is integrated with Py++ package and reuse most of its infrastructure: * GCC-XML - generates an XML description of a C++ program from GCC's internal representation * pygccxml - powerful and simple Python package to work GCCXML generated file. * Py++ design, code and utilities * It was build with future ( ctypes-cpp ) functionality in mind. * It has cross-platform ( Windows XP and Linux Ubuntu 8.10 ) unit tests How it works: 1. Using pygccxml, the source files are parsed ( using pygccxml ) and in-memory description of the code is created 2. .dll, .map or .so file is parsed ( pygccxml ) and exported symbols list is created 3. Using decorated and undecorated names, mapping between declarations and exported symbols is created. 4. The exported symbols and the mapping are used to: * define for what declarations the code should be generated * find out function calling convention 5. The last step - the code is generated Supported functionality: * shared libraries, that were compiled using C or C++ compiler * free functions, including variable number of arguments * [global|member] [named|anonymous] variables * [named|anonymous|opaque|nested] structures * enumerations * typedefs Examples: Is it useful? - Yes. I created example, which generates code for GMP( http://gmplib.org/ ) library. The following link ( http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/examples/gmplib_dev/ ) will take you to the example. * dev - directory, which contains code generator source code * pygmplib - directory, which contains generated code - Python package, which provides access to GMP lib functionality * test.py - Python script - tester. Want to try? Windows users: http://sourceforge.net/project/showfiles.php?group_id=118209 contains few packages * ctypes code generator - stand alone executable, which generates code for a .dll file * gccxml-setup - gccxml setup file Linux users: Sorry, no binaries :-( * you need to check-out( http://gccxml.org/HTML/Download.html ) and build gccxml ( http://gccxml.org/HTML/Install.html ) * you need to check-out Py++ and pygccxml ( http://sourceforge.net/svn/?group_id=118209 ) * wrap_library.py ( http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/scripts/ ) is the script, which generates code for .so file. Your feedback is welcome. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Maik B. <bec...@go...> - 2009-01-20 13:09:33
|
2009/1/20 Roman Yakovenko <rom...@gm...>: > You don't use CVS gccxml version. Your gccxml version is 1.123, my is 1.127. > This information is written in the generated xml file. Oh Boy... To build and install gccxml from cvs I downloaded a build script. This checks out nicely, but doesn't do cvs update proper, it just sticked to the initial date That once had been checked out. I fixed it and will report the bug. I didn't got it earlier, because I never am not a frequent CVS user. I'm so sorry that I've wasted your time. Now it works just nicely! > If you use Windows you can download the binaries from the pygccxml > project on sourceforge. If Linux, than SVN tree contains executable > built on Ubuntu 8.10. While I prefer to build on linux myself, I'm very happy to take the windows Installer you've uploaded. Thank you Roman, -- Maik |
From: Roman Y. <rom...@gm...> - 2009-01-20 12:20:14
|
On Tue, Jan 20, 2009 at 12:35 PM, Maik Beckmann <bec...@go...> wrote: > Roman Yakovenko schrieb am Dienstag 20 Januar 2009 um 11:04: > >> > Yes, its in my working copy too, but not installed by >> > $ python setup.py install --root=$startdir/pkg >> >> Sorry, I always forget to add new packages to the setup.py script :-( >> >> The fix in SVN > > Ok. These are are versions I have installed: > {{{ > [maik@horst pod]$ pacman -Qs gccxml > local/gccxml-cvs 20090120-1 > GCC-XML generates an XML description of a C++ program from GCC's internal > representation > local/pygccxml-svn 1590-1 > Python wrapper of gccxml > [maik@horst pod]$ pacman -Qs pyplusplus-svn > local/pyplusplus-svn 1603-1 > Binding tool for boost.python > }}} > where the xxx in xxx-1 means the revision number for svn packages while cvs > packages tagged with the build date. > > > It doesn't work for me. The hole project dir is attached as pod.tar.gz Mike, all I need to see your problem is xml file generated by gccxml. During Py++ execution it prints command line used to generate xml file. Can you generate it and send to me? -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Maik B. <bec...@go...> - 2009-01-20 10:34:58
|
Roman Yakovenko schrieb am Dienstag 20 Januar 2009 um 11:04: > > Yes, its in my working copy too, but not installed by > > $ python setup.py install --root=$startdir/pkg > > Sorry, I always forget to add new packages to the setup.py script :-( > > The fix in SVN Ok. These are are versions I have installed: {{{ [maik@horst pod]$ pacman -Qs gccxml local/gccxml-cvs 20090120-1 GCC-XML generates an XML description of a C++ program from GCC's internal representation local/pygccxml-svn 1590-1 Python wrapper of gccxml [maik@horst pod]$ pacman -Qs pyplusplus-svn local/pyplusplus-svn 1603-1 Binding tool for boost.python }}} where the xxx in xxx-1 means the revision number for svn packages while cvs packages tagged with the build date. It doesn't work for me. The hole project dir is attached as pod.tar.gz including the build log pod/log The generated file is pod/build/pyMaik.cpp The python code for py++ is in pod/build/generate_code.py which is in turn generated by cmake from pod/generate_code.py.in. I guess I missed some adjustments for generate_code.py.in, sorry. If you want to build it yourself, make sure gccxml and cmake-2-6-x are on the path, pygccxml and py++ are installed for the python executable on the path and run at pod/ rm build -r mkdir build cd build #export BOOST_ROOT=/path/to/boost #optional, if its not installed cmake .. make On Windows, it works the same with cygwin or msys. For VisualStudio the cmake-gui.exe shipped with cmake2.6.x is more convenient. Thanks, -- Maik |
From: Roman Y. <rom...@gm...> - 2009-01-20 10:04:33
|
On Tue, Jan 20, 2009 at 11:57 AM, Maik Beckmann <bec...@go...> wrote: > Roman Yakovenko schrieb am Dienstag 20 Januar 2009 um 10:33: > >> Strange, the "indexing_suite" package exists in repository: >> http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/pypluspl >>us/code_repository/ > > Yes, its in my working copy too, but not installed by > $ python setup.py install --root=$startdir/pkg Sorry, I always forget to add new packages to the setup.py script :-( The fix in SVN -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Maik B. <bec...@go...> - 2009-01-20 09:56:31
|
Roman Yakovenko schrieb am Dienstag 20 Januar 2009 um 10:33: > Strange, the "indexing_suite" package exists in repository: > http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/pypluspl >us/code_repository/ Yes, its in my working copy too, but not installed by $ python setup.py install --root=$startdir/pkg = working copy = {{{ [maik@horst pyplusplus-svn]$ ls -1 src/pyplusplus/pyplusplus/code_repository/ __init__.py array_1.py call_policies.py convenience.py ctypes_integration.py ctypes_utils.py gil_guard.py indexing_suite named_tuple.py return_pointee_value.hpp return_range.py }}} = installed = {{{ [maik@horst pyplusplus-svn]$ ls -1 pkg/usr/lib/python2.6/site- packages/pyplusplus/code_repository/|grep -v pyc$ __init__.py array_1.py call_policies.py convenience.py ctypes_integration.py ctypes_utils.py gil_guard.py named_tuple.py return_range.py }}} |
From: Roman Y. <rom...@gm...> - 2009-01-20 09:33:44
|
On Tue, Jan 20, 2009 at 11:23 AM, Maik Beckmann <bec...@go...> wrote: > Roman Yakovenko schrieb am Dienstag 20 Januar 2009 um 08:44: > >> Done. It seems like you are using buggy GCCXML version or wrong Py++. > >> I committed new test case for Py++ and everything works just fine ( > >> http://pygccxml.svn.sourceforge.net/viewvc/pygccxml?view=rev ) > >> I also attached the generated code. > >> I use current GCCXML cvs and current Py++ & pygccxml SVN. > >> > >> Happy upgrading :-) > > gccxml-cvs is just updated, rebuild and installed. > > pygccxml is on rev 1590 > > pyplusplus is on revision 1602 > > it fails with > > {{{ > > File > "/usr/lib/python2.6/site-packages/pyplusplus/code_repository/__init__.py", > line 23, in <module> > > import indexing_suite > > ImportError: No module named indexing_suite > > }}} Strange, the "indexing_suite" package exists in repository: http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/pyplusplus/code_repository/ -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Maik B. <bec...@go...> - 2009-01-20 09:31:50
|
Maik Beckmann schrieb am Dienstag 20 Januar 2009 um 07:44: > Roman Yakovenko schrieb am Dienstag 20 Januar 2009 um 06:59: > > Maik, for some reason your message was bounced. > > Yikes! I don't use SF mailing lists a lot, but I guess it was to long. > > > P.S. Please format a little the code, so it could be easier to read. > > Thanks > Ok, I think both happened because I didn't noticed kmail switched html- formatting on. Sorry! |
From: Maik B. <bec...@go...> - 2009-01-20 09:22:31
|
Roman Yakovenko schrieb am Dienstag 20 Januar 2009 um 08:44: > Done. It seems like you are using buggy GCCXML version or wrong Py++. > I committed new test case for Py++ and everything works just fine ( > http://pygccxml.svn.sourceforge.net/viewvc/pygccxml?view=rev ) > I also attached the generated code. > I use current GCCXML cvs and current Py++ & pygccxml SVN. > > Happy upgrading :-) gccxml-cvs is just updated, rebuild and installed. pygccxml is on rev 1590 pyplusplus is on revision 1602 it fails with {{{ File "/usr/lib/python2.6/site- packages/pyplusplus/code_repository/__init__.py", line 23, in <module> import indexing_suite ImportError: No module named indexing_suite }}} -- Maik |
From: Roman Y. <rom...@gm...> - 2009-01-20 07:44:28
|
On Tue, Jan 20, 2009 at 8:44 AM, Maik Beckmann <bec...@go...> wrote: >> Obviously this is a bug. I will check it against current SVN ( both > >> gccxml and Py++ ). > > Thanks for taking care Done. It seems like you are using buggy GCCXML version or wrong Py++. I committed new test case for Py++ and everything works just fine ( http://pygccxml.svn.sourceforge.net/viewvc/pygccxml?view=rev ) I also attached the generated code. I use current GCCXML cvs and current Py++ & pygccxml SVN. Happy upgrading :-) -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Maik B. <bec...@go...> - 2009-01-20 06:43:51
|
Roman Yakovenko schrieb am Dienstag 20 Januar 2009 um 06:59: > Maik, for some reason your message was bounced. Yikes! I don't use SF mailing lists a lot, but I guess it was to long. > Boost.Python don't like such structs - it cannot track the memory > usage reliably. > You also force your users to be aware of the memory management issue ( > keep LookupTable alive, until LookupTables class instance is alive ) The generated bindings are for testing purposes only. Having python gives me numpy, matplotlib and vtk/tvtk. The data I'm passing around reaches the limits of 32Bit memory machines, so I decided to sacrifice the ease use to some extend. > > There are three problems: > > 1. > > The wrapper ctors are trouble. It's default construct breaks compilation, > > because there is no way it can proper initialize the members of the > > Refer. Refer lacks the ctor to do this (by intention, see above). > > Wrapping isn't an option AFAICT. > > Obviously this is a bug. I will check it against current SVN ( both > gccxml and Py++ ). Thanks for taking care > > 2. The call policies for the __init__(self) are not altered > > You have a bug in the relevant code: > > defctor = foo.operator(arg_types=[None]) > > defctor = foo.find_trivial_constructor() > if defctor: > .... I'll check it > > === regarding 3. === > > So far I didn't get how class_t.add_fake_constructors works. This > > function takes a calldef_t as argument. If I inject code via > > mb.add_declaration_code mb.free_function('make_refer') doesn't work > > because gccxml newer saw the code. Any hints how to construct a calldef_t > > after gccxml ran? > > You don't. Tweaking declarations tree is not a good idea. Roger > > As a workaround I added the code to the parsed header file and did > > mb.class_('Refer').add_fake_constructors(mb.free_function('make_refer')) > > which results in > > {{{ > > File > > "/usr/lib/python2.6/site-packages/pyplusplus/decl_wrappers/class_wrapper. > >py", line 210, in add_fake_constructors self._fake_constructors.add( f ) > > AttributeError: 'list' object has no attribute 'add > > }}} > > This is a bug, which I fixed right now. Thanks for reporting. > It seems that I always used\tested the other path :-). Well, there are downsides of dynamic languages as well ;) I don't wanna miss the static nature of C++, if its appropriate. > > I know doing mb.class_('Refer').exclude() and creating the wrapper code > > from the information in mb.class_('Refer') works (I did this for template > > class template member member functions), but I wonder what are the other > > means to teach py++ what I want. > > I am going to play with your example, stay turned :-) Thank you Roman! -- Maik > P.S. Please format a little the code, so it could be easier to read. Thanks The Mail in my output folder is all formatted. The bouncer must have removed the leading whitespace. I can send you the mail again off list, if you like to. Next time this happens, please refuse to read the mail and ask for the proper version(i.e. off-list). This is what I would have done. You are awesome :) |
From: Roman Y. <rom...@gm...> - 2009-01-20 05:59:44
|
On Tue, Jan 20, 2009 at 12:24 AM, <sit...@li...> wrote: > The attached message was received as a bounce, but either the bounce > format was not recognized, or no member addresses could be extracted > from it. This mailing list has been configured to send all > unrecognized bounce messages to the list administrator(s). Maik, for some reason your message was bounced. > ---------- Forwarded message ---------- > From: Maik Beckmann <bec...@go...> > To: pyg...@li... > Date: Mon, 19 Jan 2009 22:34:50 +0100 > Subject: wrapping pod struct with reference member variables > > Hi, > > I use structs with reference members for convenience naming in my code. For example > struct LookupTables{ > LookupTable& Fx,Fy,Fz; > }; > The ctor is omitted by intention to be able to use it like an POD > LookupTables lt = > { > forcesLookupTables[0], forcesLookupTables[1], forcesLookupTables[1] > }; Boost.Python don't like such structs - it cannot track the memory usage reliably. You also force your users to be aware of the memory management issue ( keep LookupTable alive, until LookupTables class instance is alive ) > = Hand written bpl code = > Wrapping this code with boost python is possible. > Consider this code > struct Refee { }; > struct Refer { Refee& refee; }; > The hand written written wrapper code looks like this > {{{ > namespace boost { namespace python { > struct no_default_ctor_policy : default_call_policies > { > static bool precall(PyObject*) > { > PyErr_SetString(PyExc_StandardError, "no default ctor"); > throw_error_already_set(); > } > }; > }} // ns boost::python > namespace { > void set_refee(Refer& refer, Refee& refee) > { refer.refee = refee; } > Refee get_refee(Refer& refer) > { return refer.refee; } > std::auto_ptr<Refer> make_refer(Refee* refee) > { > Refer tmp = { *refee }; > return std::auto_ptr<Refer>(new Refer(tmp)); > } > } //anonymous ns > BOOST_PYTHON_MODULE(pyExample) > { > bp::class_<Refee>("Refee"); > bp::class_<Refer>("Refer", bp::init<>()[bp::no_default_ctor_policy()]) > .def("__init__", bp::make_constructor(make_refer)) > .add_property("refee", get_refee, set_refee); > } > }}} > There are two tricks. > 1. Calling the default __init__(self) would cause an dangling reference. no_default_ctor_policy raises an error if someone call Refer() > 2. getter and setter are free functions, nothing special > This code > {{{ > from pyExample import Refer, Refee > refee = Refee() > #refer = Refer(r)# raises error > refer = Refer(refee) > }}} > works. > = pyplusplus = > py++ however, generates this (reformatted to make it a little shorter) > {{{ > struct Refer_wrapper : Refer, bp::wrapper< Refer > { > Refer_wrapper(Refer const & arg ): Refer( arg ) , bp::wrapper< Refer >() > { } > Refer_wrapper() : Refer(), bp::wrapper< Refer >() > { } > static ::Refee & get_refee( Refer& inst ) { > return inst.refee; > } > static void set_refee( Refer& inst, ::Refee & new_value ){ > inst.refee = new_value; > } > }; > BOOST_PYTHON_MODULE(pyExample){ > bp::class_< Refee >( "Refee" ); > { //::Refer > typedef bp::class_< Refer_wrapper > Refer_exposer_t; > Refer_exposer_t Refer_exposer = Refer_exposer_t( "Refer" ); > bp::scope Refer_scope( Refer_exposer ); > Refer_exposer.def( "get_refee" > , (::Refee & (*)( ::Refer & ))(&Refer_wrapper::get_refee) > , bp::return_value_policy< bp::copy_non_const_reference >() ); > Refer_exposer.def( "set_refee" > , (void (*)( ::Refer &,::Refee & ))(&Refer_wrapper::set_refee) ); > } > } > }}} > == Problems == > There are three problems: > 1. > The wrapper ctors are trouble. It's default construct breaks compilation, because there is no way it can proper initialize the members of the Refer. Refer lacks the ctor to do this (by intention, see above). > Wrapping isn't an option AFAICT. Obviously this is a bug. I will check it against current SVN ( both gccxml and Py++ ). > 2. The call policies for the __init__(self) are not altered You have a bug in the relevant code: > defctor = foo.operator(arg_types=[None]) defctor = foo.find_trivial_constructor() if defctor: .... > 3. A fake constructor (via bp::make_constructor) is needed > === regarding 1. === > Excluding all reference members stops wrapping. But then I have to write the getter/setter functions myself. > === regarding 2. === > I played around and it seems setting custom call policies > like > {{{ > Refer = mb.class_('Refer') > Refer.variables().exclude() > defctor = foo.operator(arg_types=[None]) > defctor.call_policies = call_policies.custom_call_policies("no_default_ctor_policy", "call_policies.hpp") > }}} > doesn't have an effect!? See my previous comment > === regarding 3. === > So far I didn't get how class_t.add_fake_constructors works. This function takes a calldef_t as argument. If I inject code via mb.add_declaration_code mb.free_function('make_refer') doesn't work because gccxml newer saw the code. Any hints how to construct a calldef_t after gccxml ran? You don't. Tweaking declarations tree is not a good idea. > As a workaround I added the code to the parsed header file and did > mb.class_('Refer').add_fake_constructors(mb.free_function('make_refer')) > which results in > {{{ > File "/usr/lib/python2.6/site-packages/pyplusplus/decl_wrappers/class_wrapper.py", line 210, in add_fake_constructors > self._fake_constructors.add( f ) > AttributeError: 'list' object has no attribute 'add > }}} This is a bug, which I fixed right now. Thanks for reporting. It seems that I always used\tested the other path :-). > I know doing mb.class_('Refer').exclude() and creating the wrapper code from the information in mb.class_('Refer') works (I did this for template class template member member functions), but I wonder what are the other means to teach py++ what I want. I am going to play with your example, stay turned :-) P.S. Please format a little the code, so it could be easier to read. Thanks -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2009-01-16 19:24:06
|
On Fri, Jan 16, 2009 at 3:45 PM, Maik Beckmann <bec...@go...> wrote: > Maik Beckmann schrieb am Freitag 16 Januar 2009 um 14:22: >> The only statement I've found to get what I want is >> vv = mb.class_('::std::vector< std::vector< double > >') >> vv.rename('vvector_double') > > What I actually need for my code is to set an alias for > vector<vector<double> const*> > But > vv = mb.class_('::std::vector< std::vector< double > const* >') > fails. How is it done right? Basically you have to spell the class name right. Another work around could be to define "match" function: def is_my_class( class_ ): if not class_.name.startswith( 'vector' ): return False n = class_.name[ len('vector' ): ] if 'vector' in n and 'double' in n and 'const' in n and '*' in n: return True return False my_class = mb.class_( is_my_class ) But the prefered approach to this problem is described here: http://language-binding.net/pyplusplus/documentation/how_to/hints.html By the way, if you already have define to your class in C++, than using type traits functionality could help: from pygccxml import declarations: mb = module_builder_t( ... ) typedef = mb.global_ns.typedef( '<<<your typedef>>>' ) my_class = declarations.class_traits.get_declaration( typedef ) HTH -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |