[C++-sig] Adding custom C API functionality to boost.python modules

Marcus Jannes jannes80 at hotmail.de
Mon Feb 11 16:41:10 CET 2008

I just put the Py_InitModule3() function at the end of the BOOST_PYTHON_MODULE definitions, which seems to compile fine, not sure if it will work runtime though.Thanks alot anyway> Date: Mon, 11 Feb 2008 10:27:30 -0500> From: seefeld at sympatico.ca> To: c++-sig at python.org> Subject: Re: [C++-sig] Adding custom C API functionality	to	boost.python	modules> > Marcus Jannes wrote:> > Well, i can declare/define the function, but how does the boost.python module know of it? > > Speaking of the part where you call Py_InitModule3(...) in the C API> > I'm not sure what you are trying to achieve, and how this relates to > boost.python (other than the question whether you can mix the > boost.python with the Python C API).> > With boost.python you call> > BOOST_PYTHON_MODULE(your_module_name)> {>   ...> }> > While with Python's C API you would define> > extern "C" void inityour_module_name()> {>   ...> }> > You should use one of the two, not both. (Actually, I don't see any > reason to use the C API to expose the extension module; there are good > reasons to use boost.python instead.> However, the bodies of the two blocks above may contain any mix of the > two APIs as you want.> > HTH,> 		Stefan> > -- > >        ...ich hab' noch einen Koffer in Berlin...> _______________________________________________> C++-sig mailing list> C++-sig at python.org> http://mail.python.org/mailman/listinfo/c++-sig
Kostenlose Windows Live Services in einem Komplettpaket. Gleich downloaden!

More information about the Cplusplus-sig mailing list