Commit 797faa05 authored by Ryan C. Gordon's avatar Ryan C. Gordon

Merged r2903:2904 from SDL-1.2 branch to trunk: BeOS loadso updates.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402227
parent fb64b4e6
...@@ -35,35 +35,25 @@ void * ...@@ -35,35 +35,25 @@ void *
SDL_LoadObject(const char *sofile) SDL_LoadObject(const char *sofile)
{ {
void *handle = NULL; void *handle = NULL;
const char *loaderror = "Unknown error";
image_id library_id = load_add_on(sofile); image_id library_id = load_add_on(sofile);
if (library_id == B_ERROR) { if (library_id < 0) {
loaderror = "BeOS error"; SDL_SetError(strerror((int) library_id));
} else { } else {
handle = (void *) (library_id); handle = (void *) (library_id);
} }
if (handle == NULL) {
SDL_SetError("Failed loading %s: %s", sofile, loaderror);
}
return (handle); return (handle);
} }
void * void *
SDL_LoadFunction(void *handle, const char *name) SDL_LoadFunction(void *handle, const char *name)
{ {
void *symbol = NULL; void *sym = NULL;
const char *loaderror = "Unknown error";
image_id library_id = (image_id) handle; image_id library_id = (image_id) handle;
if (get_image_symbol(library_id, status_t rc = get_image_symbol(library_id, name, B_SYMBOL_TYPE_TEXT, &sym);
name, B_SYMBOL_TYPE_TEXT, &symbol) != B_NO_ERROR) { if (rc != B_NO_ERROR) {
loaderror = "Symbol not found"; SDL_SetError(strerror(rc));
}
if (symbol == NULL) {
SDL_SetError("Failed loading %s: %s", name, loaderror);
} }
return (symbol); return (sym);
} }
void void
...@@ -77,4 +67,6 @@ SDL_UnloadObject(void *handle) ...@@ -77,4 +67,6 @@ SDL_UnloadObject(void *handle)
} }
#endif /* SDL_LOADSO_BEOS */ #endif /* SDL_LOADSO_BEOS */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment