importing SWIG extension DLL from VC++

Gordon McMillan gmcm at
Wed Nov 21 13:50:34 CET 2001

Refrigerator Johnny wrote:

> From VC++, I cant seem to import an extension DLL made with SWIG?
> for example:
> po = PyImport_ImportModule("import simple");
> po = PyRun_String("simple.jbtestfn()",Py_eval_input, pdict, pdict);

PyObject *po = PyImport_ImportModule("simple");
PyObject *md = PyModule_GetDict(po);
PyObject *fn = PyDict_GetItemString(md, "jbtestfn");
PyObject *rs = PyObject_CallFunction(fnm, "");

or maybe

PyRun_SimpleString("import simple;simple.jbtestfn()");

If you want the result, you need to go the low-level route.

- Gordon

More information about the Python-list mailing list