I accidentally sent this to we*******@pytho n.org, so this could be a
duplicate if "webmaster" forwards it to this list. :{
Hi, there.
Thanks for any help that can be offered. I've been working with Python for
a year or more now, but only doing simple extending in C/C++. I'm now
attempting some embedding and several questions have come to mind.
BTW - I'm running Windows 2000 with Python23 and VisualC++ developers
studio.
1. (Not extending/embedding related at all) How can I pass in a load/bunch
of defines so I can use them over and over again, instead of having to copy
them in every *.py script. All my scripts use an "extension" dll that I
wrote that require a lot of constants. I looked a lot at that PyMemberDef
and Type stuff but didn't get it and don't know if that's the solution
anyway.
2. A couple simple examples I've seen for initModule() are written
differently. One only calls Py_InitModule(" module", module_methods) , but
the other also calls PyImport_AddMod ule("module"). What is the difference?
What does PyImport_AddMod ule() accomplish?
3. When embedding Python into my simple application, why can't I pass
application parameters? PyRun_SimpleStr ing seems to only take hard-coded
values. Can/How can I get around this? My code looks like:
if (!Py_IsInitiali zed())
{
Py_Initialize() ;
}
PyRun_SimpleStr ing("import MyModule");
PyRun_SimpleStr ing("MyModule.i nit(1, 'c:\\diag\\dsp. ldr', 0x5555)");
PyRun_SimpleStr ing("MyModule.M emoryTest(1, 0, 1)");
PyRun_SimpleStr ing("MyModule.S hutdown()");
Py_Finalize();
But I'd like to pass application variables instead of the hard-coded 1, 0, 1
and 0x5555, such as:
int appInt = 0x5555;
PyRun_SimpleStr ing("MyModule.i nit(1, 'c:\\diag\\dsp. ldr', appInt)");
I know I'm missing something fundamental here. Please advise.
Also, is there a mailing list that I should join for this topic?
Thank you!!!!!!
Alicia.