Re: [LAD] ladspa c++ dlsym question

From: james jwm-art net <james@email-addr-hidden-art.net>
Date: Wed Nov 21 2007 - 18:17:27 EET

Thankyou, that does the trick.

You can expect to see a new release of "Wav Composer Not Toilet"
soonish.

It will include selected LADSPA plugins - hardcoded - so plugins not
supported will not be available.

and mandatory dependancy on libsndfile for all wav reading/writing.

Which should hopefully make it a whole lot nicer.

Dunno why I've been so scared of doing this, it's not so complex after
all :)

Cheers,
James.

On 21/11/2007, "Lars Luthman" wrote:

>On Wed, 2007-11-21 at 02:57 +0000, james jwm-art net wrote:
>> Hi,
>>
>> I'm attempting to use dlsym to dynamically load a ladspa plugin lib in
>> c++. I've found various web pages describing how to use dlsym in c++
>> but they do not seem entirely relevant to using ladspa (ie ladspa
>> plugins are mainly written in c) (??).
>
>The LADSPA interface is defined in terms of C structures and types, so
>the language used to write the plugin doesn't matter to the loader.
>dlsym() is what you use. Strictly speaking it should not work in a
>standards-compliant compiler without some ugly tricks since casting void
>pointers (which is what dlsym() returns) to function pointers is not
>allowed in C++, but fortunatly most compilers are not that strict about
>it.
>
>If you really want your code to work in a strict compiler you can do
>something like
>
>union {
> void* in;
> LADSPA_Descriptor_Function out;
>} foo;
>foo.in = dlsym(lib_handle, "ladspa_descriptor");
>LADSPA_Descriptor* descriptor = (*foo.out)(0);
>....
>
>which will not generate any errors, but _will_ invoke undefined
>behaviour. It works on all platforms I've tried though.
>
>
>--ll
>
>
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Wed Nov 21 20:15:04 2007

This archive was generated by hypermail 2.1.8 : Wed Nov 21 2007 - 20:15:05 EET