2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
13 static void GetErrorStr(char **error
, BOOL condition
)
17 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
|FORMAT_MESSAGE_FROM_SYSTEM
, NULL
, GetLastError(),
18 MAKELANGID(LANG_NEUTRAL
, SUBLANG_DEFAULT
), (LPSTR
)error
, 0, NULL
);
24 void __aros
Host_HostLib_FreeErrorStr(char *error
)
29 void * __aros
Host_HostLib_Open(const char *filename
, char **error
)
33 D(printf("[hostlib] Open: filename=%s\n", filename
));
34 handle
= LoadLibrary(filename
);
35 GetErrorStr(error
, !handle
);
40 int __aros
Host_HostLib_Close(void *handle
, char **error
)
44 D(printf("[hostlib] Close: handle=0x%p\n", handle
));
45 err
= !FreeLibrary(handle
);
46 GetErrorStr(error
, err
);
51 void * __aros
Host_HostLib_GetPointer(void *handle
, const char *symbol
, char **error
)
55 D(printf("[hostlib] GetPointer: handle=0x%p, symbol=%s\n", handle
, symbol
));
56 ptr
= GetProcAddress(handle
, symbol
);
57 GetErrorStr(error
, !ptr
);