[PD] declare: stdlib vs lib

Christof Ressi info at christofressi.com
Thu Mar 11 21:48:43 CET 2021


> i wonder if this is intentional. 
This is really bad. I always thought that the setup() function of the 
*same* library (binary) was guaranteed to be called only once. This 
behavior is surprising and should be fixed IMO.

I've tried [declare -stdlib vstplugin~ -lib vstplugin~] and I get a 
segfault :-/. Now, you could say it's my fault because I don't check for 
double initialization, but I really didn't expect this.

For most libraries, it is not a big deal, because they only register one 
or more Pd classes, but it is problematic for libraries which do some 
non-trivial initialization in the setup() function.

I'll add a quick fix to [vstplugin~] to avoid this situation, but we 
should also think about how to fix this in Pd. One solution could be to 
store and compare the module handle or setup function pointer.

Christof

On 11.03.2021 20:33, IOhannes m zmölnig wrote:
> hi all,
>
> i just noticed that declaring a library with *both* '-lib' and 
> '-stdlib' will load two libraries (if it can be found in the stdpath)
>
> e.g. [declare -lib bonk~ -stdlib bonk~]
>
> this will load bonk~ twice.
> typically it will load the same library twice: once it's found in the 
> stdpath, and the other time it's found in the normal paths (that 
> include the stdpath).
> sometimes two different binaries are loaded, iff the there's a library 
> with the same name is also found in a non-stdpath.
>
> i wonder if this is intentional.
>
> i'm absolutely in favour that "-lib" loads libraries in the stdpath.
> (i'm just mentioning this, even though i don't think that this is 
> actually the issue here)
>
>
> typically, libraries are not loaded multiple times and there is 
> special code that tries to prevent duplicate loading.
> however, this code does not kick in when using both -stdlib and -lib.
>
> is this intentional?
>
> gmfds
> IOhannes
>
>
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20210311/5a522f28/attachment.htm>


More information about the Pd-list mailing list