Changeset 5275:811818eb5b81 in roaraudio for include
- Timestamp:
- 11/19/11 22:54:26 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroar/roardl.h
r4708 r5275 57 57 #define ROAR_DL_FN_PROTO 11 58 58 //#define ROAR_DL_FN_ 9 59 #define ROAR_DL_FN_MAX 1659 #define ROAR_DL_FN_MAX 24 60 60 61 #define ROAR_DL_LIBPARA_VERSION 0 62 #define ROAR_DL_LIBINST_VERSION 0 61 #define ROAR_DL_LIBPARA_VERSION 1 62 #define ROAR_DL_LIBNAME_VERSION 0 63 #define ROAR_DL_LIBINST_VERSION 1 63 64 64 65 #define ROAR_DL_PLUGIN(lib) struct roar_dl_libraryinst * \ … … 74 75 static int _inited = 0; \ 75 76 static struct roar_dl_libraryinst lib; \ 77 static struct roar_dl_libraryname libname; \ 76 78 (void)para; \ 77 79 if ( _inited ) \ … … 80 82 lib.version = ROAR_DL_LIBINST_VERSION; \ 81 83 lib.len = sizeof(lib); \ 84 memset(&libname, 0, sizeof(libname)); \ 85 libname.version = ROAR_DL_LIBNAME_VERSION; \ 86 libname.len = sizeof(libname); \ 87 libname.name = #xlib; \ 88 lib.libname = &libname; \ 82 89 do 83 90 … … 87 94 } 88 95 96 #define ROAR_DL_PLUGIN_ABORT_LOADING(err) roar_err_set((err)); return NULL 97 #define ROAR_DL_PLUGIN_CHECK_VERSIONS(app,abi) if ( roar_dl_para_check_version(para, (app), (abi)) == -1 ) return NULL 89 98 #define ROAR_DL_PLUGIN_REG(fn, funcptr) (lib.func[(fn)] = (funcptr)) 90 99 #define ROAR_DL_PLUGIN_REG_UNLOAD(func) (lib.unload = (func)) 91 100 92 101 struct roar_dl_librarypara { 93 int version; 94 size_t len; 102 int version; // version of this struct type (must be ROAR_DL_LIBPARA_VERSION) 103 size_t len; // Length of this struct type (must be sizeof(struct roar_dl_librarypara) 104 105 size_t refc; // Reference counter. 106 107 size_t argc; // number of elements in argv 108 struct roar_keyval * argv; // Parameter for the plugin 109 void * args_store; // Storage area for argv's data. 110 // If not NULL this and argv will be freed. 111 // If NULL argv will be left untouched. 112 113 void * binargv; // A pointer with binary data arguments. 114 // This can be used to pass any non-string data to 115 // the plugin. Normally this is NULL or the pointer 116 // to a struct with members of whatever is needed. 117 118 const char * appname; // application name in common format: 119 // Product/Version <VendorID/VendorName> (comments) 120 // Version and comment are optional and should be avoided. 121 // When no vendor ID is registered use <VendorName>. 122 // The VendorName MUST NOT contain a slash and SHOULD 123 // be as unique as possible. 124 // Examples: roard <0/RoarAudio>, MyAPP <myapp.org>, 125 // AnAPP <Musterman GbR> 126 const char * abiversion; // The ABI version. For libraries this should be the SONAME. 127 // For applications this should be the version of the release 128 // which introduced the current ABI. 129 // Examples: libroar2, 0.5.1 130 }; 131 132 struct roar_dl_libraryname { 133 int version; 134 size_t len; 135 const char * name; //Format: shortname 136 const char * libversion; //Format: Product/Version <VendorID/VendorName> (comments) 137 const char * description; //Free form. 138 const char * contact; //Format: first ["']nick["'] last (comment) <email>/OpenPGPkey/Phone/Room 139 const char * authors; //Other authors as free form. 140 const char * license; //Format: LicenseName-Version (options) 141 //Examples: GPL-3.0, LGPL-2.1, LGPL-3.0 (or later). 95 142 }; 96 143 … … 100 147 int (*unload)(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib); 101 148 int (*func[ROAR_DL_FN_MAX])(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib); 149 struct roar_dl_libraryname * libname; 102 150 }; 103 151 104 struct roar_dl_lhandle { 105 struct roar_dl_librarypara * para; 106 struct roar_dl_libraryinst * lib; 107 #if defined(ROAR_HAVE_LIBDL) 108 void * handle; 109 #else 110 char dummy[8]; 111 #endif 112 }; 152 struct roar_dl_librarypara * roar_dl_para_new(const char * args, void * binargv, 153 const char * appname, const char * abiversion); 154 int roar_dl_para_ref (struct roar_dl_librarypara * para); 155 int roar_dl_para_unref (struct roar_dl_librarypara * para); 156 int roar_dl_para_check_version (struct roar_dl_librarypara * para, 157 const char * appname, const char * abiversion); 113 158 114 struct roar_dl_lhandle * roar_dl_open(const char * filename, int flags, int ra_init); 115 int roar_dl_close(struct roar_dl_lhandle * lhandle); 159 struct roar_dl_lhandle * roar_dl_open (const char * filename, int flags, 160 int ra_init, struct roar_dl_librarypara * para); 161 int roar_dl_close (struct roar_dl_lhandle * lhandle); 116 162 117 void * roar_dl_getsym (struct roar_dl_lhandle * lhandle, const char * sym, int type);163 void * roar_dl_getsym (struct roar_dl_lhandle * lhandle, const char * sym, int type); 118 164 119 int roar_dl_ra_init(struct roar_dl_lhandle * lhandle, const char * prefix); 165 int roar_dl_ra_init(struct roar_dl_lhandle * lhandle, 166 const char * prefix, 167 struct roar_dl_librarypara * para); 120 168 121 char * roar_dl_errstr(struct roar_dl_lhandle * lhandle); 169 const char * roar_dl_errstr (struct roar_dl_lhandle * lhandle); 170 171 struct roar_dl_librarypara * roar_dl_getpara(struct roar_dl_lhandle * lhandle); 172 const struct roar_dl_libraryname * roar_dl_getlibname(struct roar_dl_lhandle * lhandle); 122 173 123 174 #endif
Note: See TracChangeset
for help on using the changeset viewer.