From: Bill B. <wb...@gm...> - 2006-08-09 00:22:38
|
On 8/9/06, Albert Strasheim <fu...@gm...> wrote: > > Next caveat: on Windows, shared libraries aka DLLs, typically have a .dll > extension. However, Python extensions have a .pyd extension. > > We have a utility function in NumPy called ctypes_load_library which > handles > finding and loading of shared libraries with ctypes. Currently, shared > library extensions (.dll, .so, .dylib) are hardcoded in this function. > > I propose we modify this function to look something like this: > > def ctypes_load_library(libname, loader_path, distutils_hack=False): > ... > > If distutils_hack is True, instead of the default mechanism (which is > currently hardcoded extensions), ctypes_load_library should do: > > import distutils.config > so_ext = distutils.sysconfig.get_config_var('SO') > > to figure out the extension it should use to load shared libraries. This > should make it reasonably easy for people to build shared libraries with > distutils and use them with NumPy and ctypes. Wouldn't it make more sense to just rename the .pyd generated by distutils to .dll or .so? Especially since the .pyd generated by distutils won't actually be a python extension module. This renaming could be automated by a simple python script that wraps distutils. The addition of the init{modulename} function could also be done by that script. --bb |