[Numpy-discussion] dll load failed when loading numpy in embedded python

Jean-François MAUREL jfr.maurel at gmail.com
Mon Sep 6 02:27:52 EDT 2010


  Hi everyone,

I get the error: 'DLL load failed' when loading numpy in embedded 
python. I could not find a solution in the archive.
Any help appreciated.

I have written a test as follows (borrowed from an other post):
#include <stdlib.h>
#include <stdio.h>
#include <Python.h>

int load(){
   PyObject *errobj, *errdata, *errtraceback;
   char* code = "import numpy\n";
   Py_Initialize();
   PyObject *m = PyImport_AddModule("__main__");
   PyObject* d = PyModule_GetDict( m );
   PyObject * resu = PyRun_String( code, Py_file_input, d, d);
   PyErr_Fetch (&errobj, &errdata, &errtraceback);
   if (errdata != NULL){
     PyObject *s = PyObject_Str(errdata);
     char * c = PyString_AS_STRING(s);
     printf("%s\n",c);
     Py_DECREF(s);
   }else{
     printf("no errors.\n");
   }
   Py_XDECREF(errobj);
   Py_XDECREF(errdata);
   Py_XDECREF(errtraceback);
   Py_Finalize();
   return 0;
}

int main(int argc, char **argv){
   load();
   return 0;
}

this is build using:
gcc -I/openSource/python26/include -ggdb -c t.c -oc.o -Wall
gcc c.o C:\openSource\python26\libs\libpython26.a -otest.exe -Wall

configuration is:
windows vista
mingw gcc 4.5.0
python 2.6
numpy 1.5

-- 
Jean-François MAUREL






More information about the NumPy-Discussion mailing list