Index: include/libroar/roardl.h
===================================================================
--- include/libroar/roardl.h	(revision 4708)
+++ include/libroar/roardl.h	(revision 5275)
@@ -57,8 +57,9 @@
 #define ROAR_DL_FN_PROTO               11
 //#define ROAR_DL_FN_               9
-#define ROAR_DL_FN_MAX                 16
+#define ROAR_DL_FN_MAX                 24
 
-#define ROAR_DL_LIBPARA_VERSION         0
-#define ROAR_DL_LIBINST_VERSION         0
+#define ROAR_DL_LIBPARA_VERSION         1
+#define ROAR_DL_LIBNAME_VERSION         0
+#define ROAR_DL_LIBINST_VERSION         1
 
 #define ROAR_DL_PLUGIN(lib) struct roar_dl_libraryinst *                                          \
@@ -74,4 +75,5 @@
                                      static int _inited = 0;                                      \
                                      static struct roar_dl_libraryinst lib;                       \
+                                     static struct roar_dl_libraryname libname;                   \
                                      (void)para;                                                  \
                                      if ( _inited )                                               \
@@ -80,4 +82,9 @@
                                      lib.version = ROAR_DL_LIBINST_VERSION;                       \
                                      lib.len     = sizeof(lib);                                   \
+                                     memset(&libname, 0, sizeof(libname));                        \
+                                     libname.version = ROAR_DL_LIBNAME_VERSION;                   \
+                                     libname.len     = sizeof(libname);                           \
+                                     libname.name = #xlib;                                        \
+                                     lib.libname  = &libname;                                     \
                                      do
 
@@ -87,10 +94,50 @@
                                    }
 
+#define ROAR_DL_PLUGIN_ABORT_LOADING(err) roar_err_set((err)); return NULL
+#define ROAR_DL_PLUGIN_CHECK_VERSIONS(app,abi) if ( roar_dl_para_check_version(para, (app), (abi)) == -1 ) return NULL
 #define ROAR_DL_PLUGIN_REG(fn, funcptr) (lib.func[(fn)] = (funcptr))
 #define ROAR_DL_PLUGIN_REG_UNLOAD(func) (lib.unload = (func))
 
 struct roar_dl_librarypara {
- int version;
- size_t len;
+ int version;               // version of this struct type (must be ROAR_DL_LIBPARA_VERSION)
+ size_t len;                // Length of this struct type (must be sizeof(struct roar_dl_librarypara)
+
+ size_t refc;               // Reference counter.
+
+ size_t argc;               // number of elements in argv
+ struct roar_keyval * argv; // Parameter for the plugin
+ void * args_store;         // Storage area for argv's data.
+                            // If not NULL this and argv will be freed.
+                            // If NULL argv will be left untouched.
+
+ void * binargv;            // A pointer with binary data arguments.
+                            // This can be used to pass any non-string data to
+                            // the plugin. Normally this is NULL or the pointer
+                            // to a struct with members of whatever is needed.
+
+ const char * appname;      // application name in common format:
+                            // Product/Version <VendorID/VendorName> (comments)
+                            // Version and comment are optional and should be avoided.
+                            // When no vendor ID is registered use <VendorName>.
+                            // The VendorName MUST NOT contain a slash and SHOULD
+                            // be as unique as possible.
+                            // Examples: roard <0/RoarAudio>, MyAPP <myapp.org>,
+                            //           AnAPP <Musterman GbR>
+ const char * abiversion;   // The ABI version. For libraries this should be the SONAME.
+                            // For applications this should be the version of the release
+                            // which introduced the current ABI.
+                            // Examples: libroar2, 0.5.1
+};
+
+struct roar_dl_libraryname {
+ int      version;
+ size_t   len;
+ const char * name;        //Format: shortname
+ const char * libversion;  //Format: Product/Version <VendorID/VendorName> (comments)
+ const char * description; //Free form.
+ const char * contact;     //Format: first ["']nick["'] last (comment) <email>/OpenPGPkey/Phone/Room
+ const char * authors;     //Other authors as free form.
+ const char * license;     //Format: LicenseName-Version (options)
+                           //Examples: GPL-3.0, LGPL-2.1, LGPL-3.0 (or later).
 };
 
@@ -100,24 +147,28 @@
  int    (*unload)(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib);
  int    (*func[ROAR_DL_FN_MAX])(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib);
+ struct roar_dl_libraryname * libname;
 };
 
-struct roar_dl_lhandle {
- struct roar_dl_librarypara * para;
- struct roar_dl_libraryinst * lib;
-#if defined(ROAR_HAVE_LIBDL)
- void * handle;
-#else
- char dummy[8];
-#endif
-};
+struct roar_dl_librarypara * roar_dl_para_new(const char * args, void * binargv,
+                                              const char * appname, const char * abiversion);
+int roar_dl_para_ref                    (struct roar_dl_librarypara * para);
+int roar_dl_para_unref                  (struct roar_dl_librarypara * para);
+int roar_dl_para_check_version          (struct roar_dl_librarypara * para,
+                                         const char * appname, const char * abiversion);
 
-struct roar_dl_lhandle * roar_dl_open(const char * filename, int flags, int ra_init);
-int                      roar_dl_close(struct roar_dl_lhandle * lhandle);
+struct roar_dl_lhandle * roar_dl_open   (const char * filename, int flags,
+                                         int ra_init, struct roar_dl_librarypara * para);
+int                      roar_dl_close  (struct roar_dl_lhandle * lhandle);
 
-void                   * roar_dl_getsym(struct roar_dl_lhandle * lhandle, const char * sym, int type);
+void                   * roar_dl_getsym (struct roar_dl_lhandle * lhandle, const char * sym, int type);
 
-int                      roar_dl_ra_init(struct roar_dl_lhandle * lhandle, const char * prefix);
+int                      roar_dl_ra_init(struct roar_dl_lhandle * lhandle,
+                                         const char * prefix,
+                                         struct roar_dl_librarypara * para);
 
-char *                   roar_dl_errstr(struct roar_dl_lhandle * lhandle);
+const char *             roar_dl_errstr (struct roar_dl_lhandle * lhandle);
+
+struct roar_dl_librarypara       * roar_dl_getpara(struct roar_dl_lhandle * lhandle);
+const struct roar_dl_libraryname * roar_dl_getlibname(struct roar_dl_lhandle * lhandle);
 
 #endif
