Changeset 3355:0541a1f8b343 in roaraudio for roard/plugins.c
- Timestamp:
- 02/08/10 15:11:42 (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/plugins.c
r3354 r3355 25 25 #include "roard.h" 26 26 27 #define MAX_PLUGINS 8 28 29 static struct roar_dl_lhandle * g_plugins[MAX_PLUGINS]; 30 31 static struct roar_dl_lhandle ** _find_free(void) { 32 int i; 33 34 for (i = 0; i < MAX_PLUGINS; i++) { 35 if ( g_plugins[i] == NULL ) 36 return &(g_plugins[i]); 37 } 38 39 return NULL; 40 } 41 27 42 int plugins_preinit (void) { 43 memset(g_plugins, 0, sizeof(g_plugins)); 44 28 45 return 0; 29 46 } 30 47 31 48 int plugins_init (void) { 49 int i; 50 51 for (i = 0; i < MAX_PLUGINS; i++) { 52 if ( g_plugins[i] != NULL ) { 53 roar_dl_ra_init(g_plugins[i], NULL); 54 } 55 } 56 32 57 return 0; 33 58 } 34 59 35 60 int plugins_free (void) { 61 int i; 62 63 for (i = 0; i < MAX_PLUGINS; i++) { 64 if ( g_plugins[i] != NULL ) { 65 roar_dl_close(g_plugins[i]); 66 } 67 } 68 36 69 return 0; 37 70 } 38 71 39 72 int plugins_load (const char * filename) { 40 return -1; 73 struct roar_dl_lhandle ** next = _find_free(); 74 75 if ( next == NULL ) 76 return -1; 77 78 *next = roar_dl_open(filename, -1, 0 /* we delay this until plugins_init() */); 79 if ( *next == NULL ) 80 return -1; 81 82 return 0; 41 83 } 42 84
Note: See TracChangeset
for help on using the changeset viewer.