diff options
author | David Robillard <d@drobilla.net> | 2011-02-04 05:48:37 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-02-04 05:48:37 +0000 |
commit | 77a78c6535a62bdadbf780a069aa47a4bfd01805 (patch) | |
tree | 1ef344a592e67a503b83ab92b82d34106283380d /src/slv2_internal.h | |
parent | ea4087e0029c4f6c6f80716b50ddf60120598b1b (diff) | |
download | lilv-77a78c6535a62bdadbf780a069aa47a4bfd01805.tar.gz lilv-77a78c6535a62bdadbf780a069aa47a4bfd01805.tar.bz2 lilv-77a78c6535a62bdadbf780a069aa47a4bfd01805.zip |
Fix "ISO C forbids initialization between function pointer and ‘void *’" warnings.
Fix crash when plugins have no required or optional features.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2908 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/slv2_internal.h')
-rw-r--r-- | src/slv2_internal.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/slv2_internal.h b/src/slv2_internal.h index 1c87a5e..2691c5d 100644 --- a/src/slv2_internal.h +++ b/src/slv2_internal.h @@ -30,6 +30,7 @@ extern "C" { #include <stdint.h> #include <stdlib.h> #include <inttypes.h> +#include <dlfcn.h> #include <glib.h> #include "serd/serd.h" #include "sord/sord.h" @@ -322,6 +323,17 @@ char* slv2_strjoin(const char* first, ...); const char* slv2_get_lang(); uint8_t* slv2_qname_expand(SLV2Plugin p, const char* qname); +typedef void (*VoidFunc)(); + +/** dlsym wrapper to return a function pointer (without annoying warning) */ +static inline VoidFunc +slv2_dlfunc(void* handle, const char* symbol) +{ + typedef VoidFunc (*VoidFuncGetter)(void*, const char*); + VoidFuncGetter dlfunc = (VoidFuncGetter)dlsym; + return dlfunc(handle, symbol); +} + /* ********* Dynamic Manifest ********* */ #ifdef SLV2_DYN_MANIFEST static const LV2_Feature* const dman_features = { NULL }; |