Alan Baljeu wrote:
I misspoke. I want a Python function. I was confused by the lack of any
PyModule_GetFunction or anything resembling that in the API.
This is because there is nothing special about functions, as far as
retrieving them from a module('s namespace) is concerned. You just ask
for an object, and then eventually call it.
Of course, Python and C (C++) are sufficiently different to make this
quite laboreous, when doing it 'by hand': As Python is dynamically
typed, you need to wrap your function arguments up into tuples and
dictionaries, be careful about reference counting, etc., etc.
boost.python can be extremely helpful in making the required code concise.
object module = import("your_module");
object function = module["your_function"];
function(); // call it
I take it this is Boost? I haven't looked at that. I was just studying the
built-in API.
Ah, that was another misunderstanding of mine. I thought that when you
were talking about the 'embedding tutorial' you were referring to
http://www.boost.org/doc/libs/1_37_0/libs/python/doc/tutorial/doc/html/python/embedding.html
Regards,
Stefan
--
...ich hab' noch einen Koffer in Berlin...
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig