def dlopenex(name): res = rwin32.LoadLibraryExA(name) if not res: err = rwin32.GetLastError_saved() ustr, lgt = rwin32.FormatErrorW(err) raise DLOpenError(ustr) return res
def dlopenex(name): res = rwin32.LoadLibraryExA(name) if not res: err = rwin32.GetLastError_saved() ustr = rwin32.FormatErrorW(err) # DLOpenError unicode msg breaks translation of cpyext create_extension_module raise DLOpenError(ustr.encode('utf-8')) return res
def dlopenex(name, flags=rwin32.LOAD_WITH_ALTERED_SEARCH_PATH): # Don't display a message box when Python can't load a DLL */ old_mode = rwin32.SetErrorMode(rwin32.SEM_FAILCRITICALERRORS) res = rwin32.LoadLibraryExA(name, flags) rwin32.SetErrorMode(old_mode) if not res: err = rwin32.GetLastError_saved() ustr, lgt = rwin32.FormatErrorW(err) raise DLOpenError(ustr) return res
def test_loadlibraryA(): # test0 can be loaded alone, but test1 requires the modified search path hdll = rwin32.LoadLibrary(test0) assert hdll faddr = rwin32.GetProcAddress(hdll, 'internal_sum') assert faddr assert rwin32.FreeLibrary(hdll) hdll = rwin32.LoadLibrary(test1) assert not hdll assert os.path.exists(test1) hdll = rwin32.LoadLibraryExA(test1) assert hdll faddr = rwin32.GetProcAddress(hdll, 'sum') assert faddr assert rwin32.FreeLibrary(hdll)