[PD-dev] Multiple Instance of pdlib

Kjetil Matheussen k.s.matheussen at gmail.com
Sun Dec 8 10:12:03 CET 2013


Excellent plan.

In my branch of libpd on Github, I've solved the Pd multiple
instances problem by letting the linker take care of separating
the global variables. However, using the linker causing various
problems, such as making it very difficult to load externals,
and it should probably also be considered a hack.
Your plan (the plan I didn't bother doing in my branch) is quite
undoubtedly the proper way to do it, and hopefully I would have time to
help. At least I would be helping to debug it afterwards,
because I would start using this system (in the Radium music editor),
instead of my own, to embed Pd instances.

And an advantage to Pd itself might be that the source could be clearer when
variables that belongs to the instance, actually are denoted as such
in the text.

There is also quite microscopic concern, which is that the added
amount of text could make the source more difficult to read,
here and there. Maybe a very short variable name for the pd instance,
such as "p", "pi', would be a good idea. (i.e. not "pure_data_instance").



On Sat, Dec 7, 2013 at 10:20 PM, Rob Bairos <rob at derivative.ca> wrote:
> Sorry, most of my original post got cut off.
> Here's the rest (minus the list of symbols) in case its causing a problem:
>
>
> From my understanding, the current proposed solution is to take all statics
> and globals,
> encapsulate them in one object, and pass that object to all api calls.
> Peter further suggested legacy api is maintained by having them call the new
> api with a default instance object.
>
> I did a little bit of hunting, using objdump on the current dll, to get a
> rough list of all the globals and statics currently involved.
>
> Im thinking the *_class and *_sym static pointers are in fact constant, and
> need only one shared instance.  That would leave about 320 variables
> remaining.
> Many of these variables are constant arrays, strings, etc.
> And many seem to be used only as a shortcut for passing data between two
> functions, possibly bringing down the number further.
>
> Im toying with the idea of taking on this task if anyone's interested.
> I may require some tips and help from the forum, in terms of creating a
> branch, explanation of some statics etc.
>
> So how feasible is this? Am I on the right track?
> Thanks very much,
> Rob Bairos.
>
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at iem.at
> http://lists.puredata.info/listinfo/pd-dev
>



More information about the Pd-dev mailing list