comparison src/loadso/beos/SDL_sysloadso.c @ 1895:c121d94672cb

SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 10 Jul 2006 21:04:37 +0000
parents 92947e3a18db
children 8d4c2498bb72
comparison
equal deleted inserted replaced
1894:c69cee13dd76 1895:c121d94672cb
29 #include <stdio.h> 29 #include <stdio.h>
30 #include <be/kernel/image.h> 30 #include <be/kernel/image.h>
31 31
32 #include "SDL_loadso.h" 32 #include "SDL_loadso.h"
33 33
34 void *SDL_LoadObject(const char *sofile) 34 void *
35 SDL_LoadObject(const char *sofile)
35 { 36 {
36 void *handle = NULL; 37 void *handle = NULL;
37 const char *loaderror = "Unknown error"; 38 const char *loaderror = "Unknown error";
38 image_id library_id = load_add_on(sofile); 39 image_id library_id = load_add_on(sofile);
39 if ( library_id == B_ERROR ) { 40 if (library_id == B_ERROR) {
40 loaderror = "BeOS error"; 41 loaderror = "BeOS error";
41 } else { 42 } else {
42 handle = (void *)(library_id); 43 handle = (void *) (library_id);
43 } 44 }
44 45
45 if ( handle == NULL ) { 46 if (handle == NULL) {
46 SDL_SetError("Failed loading %s: %s", sofile, loaderror); 47 SDL_SetError("Failed loading %s: %s", sofile, loaderror);
47 } 48 }
48 return(handle); 49 return (handle);
49 } 50 }
50 51
51 void *SDL_LoadFunction(void *handle, const char *name) 52 void *
53 SDL_LoadFunction(void *handle, const char *name)
52 { 54 {
53 void *symbol = NULL; 55 void *symbol = NULL;
54 const char *loaderror = "Unknown error"; 56 const char *loaderror = "Unknown error";
55 image_id library_id = (image_id)handle; 57 image_id library_id = (image_id) handle;
56 if ( get_image_symbol(library_id, 58 if (get_image_symbol(library_id,
57 name, B_SYMBOL_TYPE_TEXT, &symbol) != B_NO_ERROR ) { 59 name, B_SYMBOL_TYPE_TEXT, &symbol) != B_NO_ERROR) {
58 loaderror = "Symbol not found"; 60 loaderror = "Symbol not found";
59 } 61 }
60 62
61 if ( symbol == NULL ) { 63 if (symbol == NULL) {
62 SDL_SetError("Failed loading %s: %s", name, loaderror); 64 SDL_SetError("Failed loading %s: %s", name, loaderror);
63 } 65 }
64 return(symbol); 66 return (symbol);
65 } 67 }
66 68
67 void SDL_UnloadObject(void *handle) 69 void
70 SDL_UnloadObject(void *handle)
68 { 71 {
69 image_id library_id; 72 image_id library_id;
70 if ( handle != NULL ) { 73 if (handle != NULL) {
71 library_id = (image_id)handle; 74 library_id = (image_id) handle;
72 unload_add_on(library_id); 75 unload_add_on(library_id);
73 } 76 }
74 } 77 }
75 78
76 #endif /* SDL_LOADSO_BEOS */ 79 #endif /* SDL_LOADSO_BEOS */
80 /* vi: set ts=4 sw=4 expandtab: */