[ctypes-commit] ctypes/ctypes _loader.py,1.1.2.12,1.1.2.13
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2006-03-03 17:47:19
|
Update of /cvsroot/ctypes/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18044 Modified Files: Tag: branch_1_0 _loader.py Log Message: Add a 'load_library' method to the library loader class. This directly passes the supplied name to the platform's dlopen() or LoadLibrary() call. For backwards compatibility, this method is also available under the alias name 'LoadLibrary'. Index: _loader.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/Attic/_loader.py,v retrieving revision 1.1.2.12 retrieving revision 1.1.2.13 diff -C2 -d -r1.1.2.12 -r1.1.2.13 *** _loader.py 26 Jan 2006 21:02:49 -0000 1.1.2.12 --- _loader.py 3 Mar 2006 17:47:15 -0000 1.1.2.13 *************** *** 112,115 **** --- 112,130 ---- return self._load(libname, mode) + def load_library(self, libname, mode=None): + """Load and return the library with the given libname. This + method passes the specified 'libname' directly to the + platform's library loading function (dlopen, or LoadLibrary). + + 'mode' allows to override the default flags specified in the + constructor, it is ignored on Windows. + """ + if mode is None: + mode = self._mode + return self._dlltype(libname, mode) + + # alias name for backwards compatiblity + LoadLibrary = load_library + # Helpers for load and load_version - assembles a filename from name and filename if os.name in ("nt", "ce"): *************** *** 121,126 **** return self.load(name, mode) ! def _load(self, libname, mode): ! return self._dlltype(libname, mode) elif os.name == "posix" and sys.platform == "darwin": --- 136,140 ---- return self.load(name, mode) ! _load = load_library elif os.name == "posix" and sys.platform == "darwin": *************** *** 137,141 **** except ValueError: raise OSError("Library %s could not be found" % libname) ! return self._dlltype(pathname, mode) elif os.name == "posix": --- 151,155 ---- except ValueError: raise OSError("Library %s could not be found" % libname) ! return self.load_library(pathname, mode) elif os.name == "posix": *************** *** 146,151 **** return self.load("lib%s.so" % name, mode) ! def _load(self, libname, mode): ! return self._dlltype(libname, mode) else: --- 160,164 ---- return self.load("lib%s.so" % name, mode) ! _load = load_library else: *************** *** 154,159 **** return self.load(name, mode) ! def _load(self, libname, mode): ! return self._dlltype(libname, mode) def load_version(self, name, version=None, mode=None): --- 167,171 ---- return self.load(name, mode) ! _load = load_library def load_version(self, name, version=None, mode=None): |