From: Ajay <abr...@ma...> - 2004-09-27 14:23:03
|
hi! i built PyOpenSSL for WinCE, but when i was getting an error on import. thinking that perhaps the way i went about doing it wasn't correct (i didn't use setup.py since i dont have enough knowhow about hacking it to make it work on WinCE, i simply combined all the C code and compiled it into a DLL). I then tried writing a simple C file that makes a few calls to the OpenSS= L API. the code is below. this builds fine, but again when i do >>>import testssl i get ImportError: DLL load failed. The specified module could not be found. i am hoping people on this list, hopefully the developers of PyOpenSSL (w= ho have written code like the one below), could shed some light on what it i= s thats wrong with my piece of code. 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 =3D 512; SSL_load_error_strings(); ERR_load_BIO_strings(); OpenSSL_add_all_algorithms(); bio =3D BIO_new_connect("www.ibm.com:80"); if(bio=3D=3DNULL) { //handle error x =3D -5; } if(BIO_do_connect(bio) <=3D 0) { //handle failed connection x =3D -4; } x =3D BIO_read(bio, buf, len); if(x =3D=3D 0) { //handle closed connection x =3D -3; } else if(x<0) { if(! BIO_should_retry(bio)) { //handle failed read x =3D -2; } //do something to handle the retry } return Py_BuildValue("i", x); } static PyMethodDef testSSLMethods[] =3D { {"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. |