Inserting a dictionary of lists into '__main__' of an embeddedinterpreter

Q

quadric

Hi,

I have an application that has an embedded interpreter. This application
loads many
DLL's and passes a PyObject * to each DLL that was gotten from the
following call:

PyObject * pmod = PyImport_AddModule("__main__") ;


Later, in one of the many DLL's that interact with the embedded
interpreter, I attempt to insert
a dictionary of lists into the module represented by the pointer
'pmod' passed to the DLL from the
main application.

The dictionary of lists is created with the following call:

PyObject * abm_dict = Py_BuildValue( "{s:O,s:O,s:O,s:O,s:O,s:O,s:O,s:O,s:O}" ,
"i_list" , i_list , "l_list" , l_list ,
"bpl_list" , bpl_list,
"rt_list"
, rt_list , "st_list" ,st_list , "u2_list" , u2_list ,
"t_list"
, t_list ,"ot_list" , ot_list , "plt_list" , plt_list
);

where each item following a quoted string is a PyObject * created by
another Py_BuildValue statement.

After building 'abm_dict' , I attempt to insert it into the embedded
interpreter with the following call:

PyModule_AddObject( pmod , "abm_dict" , abm_dict );

The application crashes at this point.

Being a bit new to embedded Python, I don't readily see what I'm doing
wrong. Could one of you more
experienced guys save me a whole lot of time and point out the obvious to me?

Thanks for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top