[PD-dev] loading an external from gui-plugin (or vice-versa)

IOhannes m zmölnig zmoelnig at iem.at
Thu Apr 21 16:08:56 CEST 2016

i'm developing a little something that consists of a gui-plugin and some
library running on the pd-core side.

the gui plugin does not make any sense without the library loaded and

so i'm looking for the best way to
a1) load an external from a gui-plugin
a2) load a gui-plugin from an external
b) check from one side that the other side is initialized properly.

all of the above should not make any assumptions about the OS.
all of the above should work without any nasty trace-back errors.
instead, i would like to do the error-reporting myself (a traceback is
cool for a dev; less so for a user)

ad a1) i was thinking about abusing one of the invisible
template-canvases to instantiate a dummy object that triggers the
library load (e.g. "_float_template"). are there any pitfalls that i
should be aware of?

ad a2) the main reason or writing a GUI-plugin is to get rid of any
tcl/tk hard-coded into the C-plugin. i guess sending a command like
"load_plugin_script mycoolthing" is platform agnostic enough for my
needs. however, it seems that the only way to load a plugin is currently
by specifying the full filename: "load_plugin_script mycoolthing.tcl"; hmpf
it also throws a nasty error if Pd cannot find the GUI-plugin:
> Tcl) UNHANDLED ERROR: couldn't open "mycoolthing.tcl": no such file or

ad b) the basic idea is to have a ping-function on the *other* side,
that replies with a "hi, i'm here" when called.
so far i've found two options:
b1) create a proc in the plugin, and call that directly from the core;
or b2) have the GUI register a plugin-receiver that does the dispatching.
unfortunately both solutions give me a backtrace when the GUI-plugin has
not been instantiated (and the point of the exercise is to avoid a


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20160421/e2b5dd60/attachment.sig>

More information about the Pd-dev mailing list