libpd
will look in pd-externals
for files with the same name as the object you are creating when you try to load an external. As I understand it, zexy
comes as a single-file library, so that, e.g.: there is no date.pd_linux
file in pd-externals
. For this reason, when you try to create the [date]
object, it fails.
There is one way of importing libraries that will work with both Pd and libpd
: create in your patch an object with the name of the library, e.g.: [zexy]
(note: this must be created in your patch before any other object, as the order of creation matters). Then you will be able to create, e.g.: [date]
.
Pd on your computer allows one additional way of doing it: you can go to preferences->startup and preload some libraries (e.g.: zexy
).
On libpd
(on Bela and elsewhere) you can import libraries by manually calling their ..._setup()
function. This involves something like this in the render
file:
NOTE: broken code do not use (see comment below)
// forward declare external setup functions
void zexy_setup();
bool setup(BelaContext* context, void* args) {
.....
// init libpd
libpd_init();
// load libs
zexy_setup();
....
}
Again, you could simply create a [zexy]
object and forget about changing the C++ source code. Yet, if you want to do that , you have a couple of options to apply these changes:
- you could edit the
core/default_libpd_render.cpp
file (not through the Bela IDE). This change is global for all your libpd projects, but when you update the board, these changes will be lost.
- you could copy that file to your project's folder and apply the edits on such copy, so the file becomes part of your project and is resilient to changes in the core code. You will then have to do this for each individual project.
More documentation on libpd
and external libraries is here. Note that you don't need the part about "Adding external source files" if you already compiled the library as an external.