[C++-sig] Creating a python class from c++

James Healey healeyjames at yahoo.co.uk
Sat Nov 18 18:15:09 CET 2006


I did ask a few posts ago if any thing should be done
with the global variable, but you gave no answer.

I also had these 2 lines before:
	// Retrieve the main module
	//boost::python::object main =
boost::python::import("__main__");

	// Retrieve the main module's namespace
	//boost::python::object
global(main.attr("__dict__"));

But it didnt compile because I never had the import
function.

Also this line:
bpl::dict global = main.attr("__dict__");

doesnt compile and switched it with:
boost::python::object global(main.attr("__dict__"));

it gave the error:
error C2440: 'initializing' : cannot convert from
'boost::python::api::object_attribute' to
'boost::python::dict'
        Constructor for class 'boost::python::dict' is
declared 'explicit'


Every thing works as asked in my original question.

Thanks for all your help.




		
___________________________________________________________ 
Yahoo! Messenger - with free PC-PC calling and photo sharing. http://uk.messenger.yahoo.com



More information about the Cplusplus-sig mailing list