467,146 Members | 1,268 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,146 developers. It's quick & easy.

ImportError: DLL load failed

hi!

I wrote a simple C code to work with OpenSSL and it builds fine.
however when i import it, i get an error
ImportError: DLL load failed. The specified module could not be found.

the file is in Python/Lib directory.

the code is below.

thanks

#include <Python.h>
#include "openssl/bio.h"
#include "openssl/ssl.h"
#include "openssl/err.h"

static PyObject * start(PyObject *self, PyObject *args)
{
int x;
BIO * bio;
char buf[1024];
int len = 512;
SSL_load_error_strings();
ERR_load_BIO_strings();
OpenSSL_add_all_algorithms();
bio = BIO_new_connect("www.ibm.com:80");
if(bio==NULL)
{
//handle error
x = -5;
}
if(BIO_do_connect(bio) <= 0)
{
//handle failed connection
x = -4;
}
x = BIO_read(bio, buf, len);
if(x == 0)
{
//handle closed connection
x = -3;
}
else if(x<0)
{
if(! BIO_should_retry(bio))
{
//handle failed read
x = -2;
}
//do something to handle the retry
}
return Py_BuildValue("i", x);
}

static PyMethodDef testSSLMethods[] = {
{"start", start, METH_VARARGS, "start and test SSL."},
{NULL, NULL, 0, NULL}
};

PyMODINIT_FUNC
inittestSSL(void)
{
(void) Py_InitModule("testSSL", testSSLMethods);
}

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Jul 18 '05 #1
  • viewed: 1617
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Cousin Stanley | last post: by
reply views Thread by Ben McBride | last post: by
11 posts views Thread by Fred | last post: by
2 posts views Thread by Adam Blinkinsop | last post: by
1 post views Thread by kyosohma@gmail.com | last post: by
1 post views Thread by Sjoerd | last post: by
2 posts views Thread by Simon Forman | last post: by
reply views Thread by Andrew MacIntyre | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.