From: Pete S. <pe...@sh...> - 2000-07-10 20:43:37
|
i had to make the following changes to pysdl to get it working on windows. before the initsdl function (line 71) i had to add the following three lines... #ifdef WIN32 _declspec(dllexport) #endif also, the research i did when first testing pysdl on windows has been missing. the currentl pysdl cannot load images under win98. replace the rw_NEW function with this, and images load fine static RW_Object* rw_NEW(PyObject* src_obj, char* mode) { RW_Object* rw_ref; if(!src_obj) return NULL; if(PyString_Check(src_obj)) return rw_NEW(PyFile_FromString(PyString_AsString(src_obj), mode), NULL); rw_ref = (RW_Object*)Py_Malloc(sizeof(RW_Object)); if(!rw_ref) return NULL; Py_INCREF(src_obj); rw_ref->obj = src_obj; #ifndef WIN32 if(PyFile_Check(src_obj)) { SDL_RWops* ops_ref = SDL_RWFromFP(PyFile_AsFile(src_obj), 0); memcpy(&rw_ref->rw, ops_ref, sizeof(SDL_RWops)); Py_Free((char*)ops_ref); rw_ref->seek = NULL; rw_ref->tell = NULL; rw_ref->read = NULL; rw_ref->write = NULL; rw_ref->close = NULL; return rw_ref; } #endif rw_ref->seek = PyObject_GetAttrString(src_obj, "seek"); rw_ref->tell = PyObject_GetAttrString(src_obj, "tell"); rw_ref->read = PyObject_GetAttrString(src_obj, "read"); rw_ref->write = PyObject_GetAttrString(src_obj, "write"); rw_ref->close = PyObject_GetAttrString(src_obj, "close"); rw_ref->rw.seek = rw_seek; rw_ref->rw.read = rw_read; rw_ref->rw.write = rw_write; rw_ref->rw.close = rw_close; PyErr_Clear(); return rw_ref; } #endif |