def dlopen(name, mode=-1): # mode is unused on windows, but a consistant signature res = rwin32.LoadLibrary(name) if not res: err = rwin32.GetLastError_saved() raise DLOpenError(rwin32.FormatError(err)) 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)
def dlopen(name, mode=-1): # mode is unused on windows, but a consistant signature res = rwin32.LoadLibrary(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