Hi,
I tried to expose objects of class:
typedef boost::tuple<ClassA, std::string> RegisterResult;
to python.
I used automatic conversion
(http://www.language-binding.net/pyplusplus/troubleshooting_guide/automatic_conversion/automatic_conversion.html)
but as usual I hit a wall and got unsolvable error.
INFO gccxml cmd: /usr/bin/gccxml -I"."
-I"/home/macieks/error_examples/boost_tuples_to_python" -I"/usr/include"
-I"/usr/include/python2.4" -I"/home/macieks/boost/boost_1_42_0"
"test.h" -fxml="/tmp/tmp9Kp4rg.xml"
Traceback (most recent call last):
File "generate.py", line 14, in ?
indexing_suite_version=2
File
"usr/lib/python2.4/site-packages/pyplusplus/module_builder/boost_python_builder.py",
line 95, in __init__
File
"usr/lib/python2.4/site-packages/pyplusplus/module_builder/boost_python_builder.py",
line 138, in __parse_declarations
File
"usr/lib/python2.4/site-packages/pygccxml/parser/project_reader.py",
line 217, in read_files
File
"usr/lib/python2.4/site-packages/pygccxml/parser/project_reader.py",
line 242, in __parse_file_by_file
File
"usr/lib/python2.4/site-packages/pygccxml/parser/source_reader.py", line
206, in read_file
File
"usr/lib/python2.4/site-packages/pygccxml/parser/source_reader.py", line
231, in read_gccxml_file
pygccxml.parser.source_reader.gccxml_runtime_error_t: Error occured
while running GCC-XML:
/home/macieks/boost/boost_1_42_0/boost/mpl/bool_fwd.hpp:21: sorry,
unimplemented: call_expr cannot be mangled due to a defect in the C++ ABI
I tried to use tuples.hpp from pyogre (it has some few lines added), but
the problem is the same.
I attached simple example files to this mail.
Best regards
--
Maciek Sitarz
import os
import sys
from pyplusplus import module_builder
mb = module_builder.module_builder_t(
files=['test.h'],
include_paths=[
os.getcwd()
, "/usr/include"
, "/usr/include/python2.4"
, "/home/macieks/boost/boost_1_42_0"
],
indexing_suite_version=2
)
mb.class_( 'ClassA' ).include()
mb.class_( '::boost::tuples::cons<ClassA, boost::tuples::cons<std::string, boost::tuples::null_type> >' ).include()
mb.print_declarations()
mb.build_code_creator( module_name='test' )
mb.code_creator.user_defined_directories.append( os.path.abspath('.') )
mb.write_module( os.path.join( os.path.abspath('.'), 'generated.cpp' ) )
#include <string>
#include <boost/tuple/tuple.hpp>
#include "tuples.hpp"
class ClassA{
int a;
public:
ClassA( void ) : a(100) { }
ClassA(int i) : a(i) { }
int funA( void ) { return a; }
};
typedef boost::tuple<ClassA, std::string> RegisterResult;
namespace pyplusplus {
namespace aliases {
typedef boost::tuple<ClassA, std::string> RegisterResult;
}
}
namespace python_test {
namespace details {
inline void instantiate() {
sizeof( ClassA );
sizeof( RegisterResult );
ClassA classA( 0 );
RegisterResult registerResult();
}
}
}
int main( void ){
ClassA classA( 0 );
RegisterResult registerResult();
}
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig