On 07/09/2010 06:36 PM, King wrote: > Hi, > > The 'zipimport' modules can only import (.py & .pyc) files from a zip > file and doesn't support importing .pyd & .so files. Recently I was > examining the code of Py2Exe (python package deployment tool) and I > have found that it is using a module 'zipextimporter' that can import > dlls(.pyd) modules from a zip file. > It is based on the concept of loading library form memory. You can > find out more about here: > http://www.joachim-bauch.de/tutorials/loading-a-dll-from-memory/ > > It's strictly for windows platform. I would like to know from expert > python users and linux programmers, how we can achieve similar > functionality on linux platform? I do have limited c/c++ skill sets > but I would love to give a try.
I don't think it's possible as such: On UNIX systems, dynamic module loading is done with the dl* functions in libdl. From the manual installed on my machine: void *dlopen(const char *filename, int flag); char *dlerror(void); void *dlsym(void *handle, const char *symbol); int dlclose(void *handle); Link with -ldl. dlopen() takes a file name. It is, as far as I know, the only, or at least the only portable way to load a shared object. There might be some way to load so's from memory on certain Unices, but these would only work on one system (and I doubt they exist anyway) So you'd have to extract the file, and make it available through the file system. This would typically mean creating a file under /tmp (or possibly under $HOME/.cache/...) Cheers Thomas > > Cheers > > Prashant > -- http://mail.python.org/mailman/listinfo/python-list