Re: [pygccxml-development] templates (again)
Brought to you by:
mbaas,
roman_yakovenko
|
From: Neal B. <ndb...@gm...> - 2006-08-31 11:51:21
|
On Thursday 31 August 2006 4:58 am, Matthias Baas wrote:
> Neal Becker wrote:
> > // file test.h
> > #include <boost/numeric/ublas/vector.hpp>
> > using namespace boost::numeric::ublas;
> >
> > typedef vector<int> vector_int;
> >
> > # File: test_setup.py
> > from pypp_api import *
> >
> > mod = ModuleBuilder(
> > headerFiles = "test.h",
> > moduleName = "test"
> > )
> >
> > root = mod.parse()
> > root.Class("vector_int").expose()
> >
> > mod.writeModule()
> >
> > result:
> > [...]
> > raise RuntimeError, "Query produced no results (filter: %s)"%filter
> > RuntimeError: Query produced no results (filter: (name=='vector_int') &
> > (type==CLASS) & (parent=='::'))
>
> Well, I have never wrapped templates so far. This part of pypp_api was
> written by Allen. You are not using the Template() method, so I don't
> know if this could already work or not. Or maybe the result is empty
> because you are actually querying for a typedef instead of a class...?
> Try Decl() instead of Class():
>
> root.Decl("vector_int").expose()
>
>
OK. This time no error, but no code generated either!
// This file has been generated by Py++.
#include "boost/python.hpp"
#include "test.h"
namespace bp = boost::python;
BOOST_PYTHON_MODULE(test){
}
---test.h
#include <boost/numeric/ublas/vector.hpp>
typedef boost::numeric::ublas::vector<int> vector_int;
inline void instantiate() {
sizeof (vector_int);
}
# File: pypp_setup.py
from pypp_api import *
mod = ModuleBuilder(
headerFiles = "test.h",
moduleName = "test"
)
root = mod.parse()
root.Decl("vector_int").expose()
mod.writeModule()
|