Changeset 5353:de96f27919bf in roaraudio
- Timestamp:
- 12/12/11 19:11:39 (12 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
configure
r5293 r5353 672 672 _have_libs=false 673 673 _have_headers=false 674 _defs='' 674 675 echo > $TF_C 676 677 $NEED_GNU_SOURCE && _defs="$_defs -D_GNU_SOURCE" 675 678 676 679 name="$1" … … 690 693 while [ "$1" != '--' ] 691 694 do 695 echo "LIB($name) HAS LIB INFO: $1" >&5 692 696 case "$1" in 693 697 'c'|'-lc') … … 742 746 echo "LIB($name) HAS COMPILER/LINKER OUTPUT:" >&5 743 747 echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5 744 $CCTF $ LIBS >&5 2>&5;748 $CCTF $_defs $LIBS >&5 2>&5; 745 749 R=$? 746 750 echo "--- END OF CHILD OUTPUT BLOCK ---" >&5 … … 894 898 895 899 test_func_defmake () { 900 _defs='' 896 901 DEF="$1" 897 902 NAME="$2" … … 902 907 CALL="$1" 903 908 shift; 909 910 $NEED_GNU_SOURCE && _defs="$_defs -D_GNU_SOURCE" 904 911 905 912 if [ "$infotext" = '' ] … … 963 970 echo "FUNCTION($NAME) HAS COMPILER/LINKER OUTPUT:" >&5 964 971 echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5 965 $CCTF $ LIBS >&5 2>&5;972 $CCTF $_defs $LIBS >&5 2>&5; 966 973 R=$? 967 974 echo "--- END OF CHILD OUTPUT BLOCK ---" >&5 … … 1822 1829 test_func_defmake ROAR_HAVE_AO_APPEND_GLOBAL_OPTION ao_append_global_option 'ao_append_global_option("","")' ao -- ao/ao.h 1823 1830 1831 test_func_defmake ROAR_HAVE_DLADDR dladdr 'dladdr((void*)0, (Dl_info*)0)' dl -- dlfcn.h 1832 echo "STATE: funcname_dladdr=$funcname_dladdr" >&5 1833 1834 if [ "$funcname_dladdr" = 'false' ] 1835 then 1836 infotext='retested with _GNU_SOURCE' 1837 _old="$NEED_GNU_SOURCE" 1838 NEED_GNU_SOURCE=true 1839 test_func_defmake ROAR_HAVE_DLADDR dladdr 'dladdr((void*)0, (Dl_info*)0)' dl -- dlfcn.h 1840 [ "$funcname_dladdr" = 'false' ] && NEED_GNU_SOURCE="$_old" 1841 infotext='' 1842 fi 1843 1824 1844 test_func_defmake ROAR_HAVE_CLOCK_GETRES clock_getres 'struct timespec ts; clock_getres((clockid_t)0, &ts)' -- time.h 1825 1845 test_func_defmake ROAR_HAVE_CLOCK_GETTIME clock_gettime 'struct timespec ts; clock_gettime((clockid_t)0, &ts)' -- time.h -
include/libroar/roardl.h
r5347 r5353 102 102 // general stuff: 103 103 #define ROAR_DL_PLUGIN_ABORT_LOADING(err) roar_err_set((err)); return NULL 104 #define ROAR_DL_PLUGIN_CHECK_VERSIONS(app,abi) if ( roar_dl_para_check_version(para, (app), (abi)) == -1 ) return NULL 104 #define ROAR_DL_PLUGIN_CHECK_VERSIONS(app,abi) ((lib.host_appname = (app)) != NULL || \ 105 (lib.host_abiversion = (abi)) != NULL ) 106 // should we keep this macro at all? Is it helpfull at all? 107 // if a plugin can handle multiple hosts it needs to call roar_dl_para_check_version() itself anyway. 108 #define ROAR_DL_PLUGIN_CHECK_VERSIONS_NOW(app,abi) if ( roar_dl_para_check_version(para, (app), (abi)) == -1 ) return NULL 105 109 106 110 // register stuff: … … 111 115 lib.global_data_init = &(init); \ 112 116 lib.global_data_pointer = (void*)&(ptr) 113 #define ROAR_DL_PLUGIN_REG_LIBDEP(deps) (((lib.libdep = deps) == NULL) ? \117 #define ROAR_DL_PLUGIN_REG_LIBDEP(deps) (((lib.libdep = (deps)) == NULL) ? \ 114 118 (ssize_t)-1 : \ 115 (ssize_t)(lib.libdep_len = sizeof( deps)/sizeof(struct roar_dl_librarydep)))119 (ssize_t)(lib.libdep_len = sizeof((deps))/sizeof(struct roar_dl_librarydep))) 116 120 117 121 // meta data stuff: … … 223 227 size_t libdep_len; 224 228 struct roar_dl_appsched * appsched; 229 const char * host_appname; 230 const char * host_abiversion; 225 231 }; 226 232 -
libroar/plugincontainer.c
r5320 r5353 44 44 size_t deprefc[MAX_PLUGINS]; 45 45 size_t numhandles; 46 // TODO: add a depref counter so we do not unload libs we depend on.47 46 }; 48 47 … … 127 126 128 127 roar_dl_close(cont->handle[i]); 128 cont->handle[i] = NULL; 129 cont->numhandles--; 129 130 } 130 131 } -
libroar/roardl.c
r5347 r5353 391 391 return -1; 392 392 393 if ( lib->host_appname != NULL || lib->host_abiversion != NULL ) { 394 // check for correct host. 395 if ( para == NULL ) { 396 roar_err_set(ROAR_ERROR_INVAL); 397 return -1; 398 } 399 if ( roar_dl_para_check_version(para, lib->host_appname, lib->host_abiversion) == -1 ) 400 return -1; 401 } 402 393 403 if ( (lib->libdep == NULL && lib->libdep_len) || (lib->libdep != NULL && !lib->libdep_len) ) { 394 404 roar_err_set(ROAR_ERROR_BADLIB); -
plugins/universal/plugin-info.c
r5342 r5353 99 99 } 100 100 101 static void print_env(void) { 102 const char * server = roar_libroar_get_server(); 103 roar_vio_printf(roar_stdout, "Default server: %s%s%s\n", 104 server == NULL ? "" : "\"", 105 server == NULL ? "<not set>" : server, 106 server == NULL ? "" : "\""); 107 } 108 101 109 static int init (struct roar_dl_librarypara * para) { 102 110 print_parameter(para); 103 111 print_notifycore(para); 112 print_env(); 104 113 print_counter(); 105 114 return 0; -
roarclients/roarpluginrunner.c
r5347 r5353 41 41 fprintf(stderr, "\nOptions:\n\n"); 42 42 43 fprintf(stderr, " -h --help - This help.\n" 44 " --verbose - Be verbose. Can be used multiple times.\n" 45 " --run - Run plugin.\n" 46 " --explain - Explain plugin.\n"); 43 fprintf(stderr, " -h --help - This help.\n" 44 " --verbose - Be verbose. Can be used multiple times.\n" 45 " --server SERVER - Set default server to SERVER.\n" 46 " --run - Run plugin.\n" 47 " --explain - Explain plugin.\n" 48 " --appname NAME - Sets the appname.\n" 49 " --abiversion ABI - Set the ABI version.\n" 50 " --args ARGS - Set plugin arguments.\n" 51 ); 47 52 } 48 53 … … 66 71 67 72 static const char * _ptr2str(const void * p) { 73 #ifdef ROAR_HAVE_DLADDR 74 static char buf[80]; 75 Dl_info info; 76 #else 68 77 static char buf[24]; 78 #endif 69 79 70 80 if ( p == NULL ) 71 81 return "<not set>"; 72 82 83 #ifdef ROAR_HAVE_DLADDR 84 if ( dladdr(p, &info) != 0 ) { 85 if ( p == info.dli_saddr ) { 86 snprintf(buf, sizeof(buf), "%p <%s in \"%s\">", p, info.dli_sname, info.dli_fname); 87 return buf; 88 } 89 } 90 #endif 91 73 92 snprintf(buf, sizeof(buf), "%p", p); 74 93 … … 77 96 78 97 static const char * _ptrrange2str(const void * p, size_t len) { 79 static char buf[ 48];98 static char buf[80]; 80 99 81 100 if ( p == NULL ) … … 112 131 lib = func(g_para); 113 132 if ( lib == NULL ) { 114 fprintf(stderr, "Warning: Can not RA init: %s \n", name);133 fprintf(stderr, "Warning: Can not RA init: %s: %s\n", name, roar_error2str(roar_error)); 115 134 roar_dl_unref(lhandle); 116 135 return 0; … … 122 141 123 142 printf("lib = %s\n", _ptr2str(lib)); 124 printf("|-> version = %i (%smatch)\n", lib->version, lib->version == ROAR_DL_LIBINST_VERSION ? "" : "no "); 125 printf("%c-> len = %zu (%smatch)\n", libok ? '|' : '\\', lib->len, lib->len == sizeof(*lib) ? "" : "no "); 143 if ( g_verbose || !libok ) { 144 printf("|-> version = %i (%smatch)\n", lib->version, lib->version == ROAR_DL_LIBINST_VERSION ? "" : "no "); 145 printf("%c-> len = %zu (%smatch)\n", libok ? '|' : '\\', lib->len, lib->len == sizeof(*lib) ? "" : "no "); 146 } 126 147 127 148 if ( libok ) { 128 printf("|-> unload = %s\n", _ptr2str(lib->unload)); 149 if ( g_verbose || lib->unload != NULL ) 150 printf("|-> unload = %s\n", _ptr2str(lib->unload)); 129 151 printf("|-> func = {"); 130 152 i = 0; … … 151 173 libnameok = 1; 152 174 } 153 printf("| |-> version = %i (%smatch)\n", lib->libname->version, 154 lib->libname->version == ROAR_DL_LIBNAME_VERSION ? "" : "no "); 155 printf("| %c-> len = %zu (%smatch)\n", libnameok ? '|' : '\\', lib->libname->len, 156 lib->libname->len == sizeof(*(lib->libname)) ? "" : "no "); 175 if ( g_verbose || !libnameok ) { 176 printf("| |-> version = %i (%smatch)\n", lib->libname->version, 177 lib->libname->version == ROAR_DL_LIBNAME_VERSION ? "" : "no "); 178 printf("| %c-> len = %zu (%smatch)\n", libnameok ? '|' : '\\', lib->libname->len, 179 lib->libname->len == sizeof(*(lib->libname)) ? "" : "no "); 180 } 181 157 182 if ( libnameok ) { 158 183 #define _ps(k,name) \ 159 184 tmp = (lib->libname->name) != NULL; \ 185 if ( tmp || g_verbose || (k) == '\\' ) \ 160 186 printf("| %c-> %-15s = %s%s%s\n", (k), #name, tmp ? "\"" : "", \ 161 187 tmp ? (lib->libname->name) : "<not set>", tmp ? "\"" : ""); … … 172 198 } 173 199 } 174 printf("|-> global_data_len = %zu\n", lib->global_data_len); 175 printf("|-> global_data_init = %s\n", _ptrrange2str(lib->global_data_init, lib->global_data_len)); 176 printf("|-> global_data_pointer = %s\n", _ptr2str(lib->global_data_pointer)); 200 if ( g_verbose || lib->global_data_pointer != NULL ) 201 printf("|-> global_data_len = %zu\n", lib->global_data_len); 202 if ( g_verbose || lib->global_data_init != NULL ) 203 printf("|-> global_data_init = %s\n", _ptrrange2str(lib->global_data_init, lib->global_data_len)); 204 if ( g_verbose || lib->global_data_pointer != NULL ) 205 printf("|-> global_data_pointer = %s\n", _ptr2str(lib->global_data_pointer)); 206 177 207 if ( lib->libdep != NULL && lib->libdep_len ) { 178 208 printf("|-> libdep = %s\n", _ptr2str(lib->libdep)); … … 186 216 libdepok = 0; 187 217 } 188 printf("| %c |-> version = %i (%smatch)\n", c, lib->libdep[iter].version, 189 lib->libdep[iter].version == ROAR_DL_LIBDEP_VERSION ? "" : "no "); 190 printf("| %c %c-> len = %zu (%smatch)\n", c, libdepok ? '|' : '\\', 191 lib->libdep[iter].len, 192 lib->libdep[iter].len == sizeof(struct roar_dl_librarydep) ? 193 "" : "no "); 218 if ( g_verbose || !libdepok ) { 219 printf("| %c |-> version = %i (%smatch)\n", c, lib->libdep[iter].version, 220 lib->libdep[iter].version == ROAR_DL_LIBDEP_VERSION ? "" : "no "); 221 printf("| %c %c-> len = %zu (%smatch)\n", c, libdepok ? '|' : '\\', 222 lib->libdep[iter].len, 223 lib->libdep[iter].len == sizeof(struct roar_dl_librarydep) ? 224 "" : "no "); 225 } 226 194 227 if ( libdepok ) { 195 228 printf("| %c |-> flags = 0x%.8lX\n", c, (unsigned long int)lib->libdep[iter].flags); 196 229 #define _ps(k,name) \ 197 230 tmp = (lib->libdep[iter].name) != NULL; \ 231 if ( tmp || g_verbose || (k) == '\\' ) \ 198 232 printf("| %c %c-> %-11s = %s%s%s\n", c, (k), #name, tmp ? "\"" : "", \ 199 233 tmp ? (lib->libdep[iter].name) : "<not set>", tmp ? "\"" : ""); … … 209 243 printf("|-> libdep_len = %zu (invalid)\n", lib->libdep_len); 210 244 } 211 printf("\\-> appsched = %s\n", _ptr2str(lib->appsched)); 212 if ( lib->appsched != NULL ) { 213 printf(" |-> init = %s\n", _ptr2str(lib->appsched->init)); 214 printf(" |-> free = %s\n", _ptr2str(lib->appsched->free)); 215 printf(" |-> update = %s\n", _ptr2str(lib->appsched->update)); 216 printf(" |-> tick = %s\n", _ptr2str(lib->appsched->tick)); 217 printf(" \\-> wait = %s\n", _ptr2str(lib->appsched->wait)); 218 } 245 if ( g_verbose || lib->appsched != NULL ) { 246 printf("|-> appsched = %s\n", _ptr2str(lib->appsched)); 247 if ( lib->appsched != NULL ) { 248 if ( lib->appsched->init != NULL ) 249 printf("| |-> init = %s\n", _ptr2str(lib->appsched->init)); 250 if ( lib->appsched->free != NULL ) 251 printf("| |-> free = %s\n", _ptr2str(lib->appsched->free)); 252 if ( lib->appsched->update != NULL ) 253 printf("| |-> update = %s\n", _ptr2str(lib->appsched->update)); 254 if ( lib->appsched->tick != NULL ) 255 printf("| |-> tick = %s\n", _ptr2str(lib->appsched->tick)); 256 printf("| \\-> wait = %s\n", _ptr2str(lib->appsched->wait)); 257 } 258 } 259 #define _ps(k,name) \ 260 tmp = (lib->name) != NULL; \ 261 if ( tmp || g_verbose || (k) == '\\' ) \ 262 printf("%c-> %-19s = %s%s%s\n", (k), #name, tmp ? "\"" : "", \ 263 tmp ? (lib->name) : "<not set>", tmp ? "\"" : ""); 264 _ps('|', host_appname); 265 _ps('\\', host_abiversion); 266 #undef _ps 219 267 } 220 268 … … 247 295 248 296 int main (int argc, char * argv[]) { 249 const char * appname = "roarpluginrunner ";250 const char * abiversion = NULL;297 const char * appname = "roarpluginrunner " ROAR_VSTR_ROARAUDIO; 298 const char * abiversion = "1.0beta0"; 251 299 const char * pluginargs = NULL; 252 300 enum action action = RUN; … … 267 315 } else if ( !strcmp(k, "--verbose") ) { 268 316 g_verbose++; 317 } else if ( !strcmp(k, "--server") ) { 318 roar_libroar_set_server(argv[++i]); 269 319 } else if ( !strcmp(k, "--appname") ) { 270 320 appname = argv[++i]; -
roard/include/plugins.h
r5275 r5353 29 29 #include <roaraudio.h> 30 30 31 #define ROARD_DL_APPNAME "roard <0/RoarAudio>"31 #define ROARD_DL_APPNAME "roard " ROAR_VSTR_ROARAUDIO 32 32 #define ROARD_DL_ABIVERSION NULL 33 33
Note: See TracChangeset
for help on using the changeset viewer.