Thanks, IOhannes, that sounds sensible. So in order to make it as homogenous as possible between people who build from source and those who install the package (as ultimately I would like this to be extension friendly at the C level), do you think it would be best to just have the scm files live in the same directory as the C files in the source? Or is there some suggested approach when using pd lib builder to make this simple? 

thanks
iain

On Mon, Oct 4, 2021 at 8:52 AM IOhannes m zmoelnig <zmoelnig@iem.at> wrote:
On 10/4/21 5:22 PM, Iain Duncan wrote:
> of the package ('s4pd') so that this can simply be put in the Pd/externals
> directory? I just need to know what "normal" is for a release package.

yes: ship the scm files besides your external.

the easiest way is to instruct people to load your library with
[declare -path s4pd -lib s4pd] (which will add .../s4pd to Pd's search
paths and *also* load the s4pd.pd_linux external).
in the s4pd_setup() (or better: s4pd_new()) callback, spit out a big fat
wraning if the scm files cannot be found like:
 > ERROR: could not find 's4pd.scm'!
 > ERROR: use [declare -path s4pd -lib s4pd] to load this external

and refuse to create an instance of the interpreter.

to make things a bit nicer, you could *additionally* search for
"s4pd/s4pd.scm", and only bail out if neither of the two can be found.


you could also check how other language bindings do this, e.g. [tclpd]
or [pdlua]
(both of which somehow try to get the path of the library file, and then
use that to load their auxiliary scripts)

gfmnasdr
IOhannes

[tclpd]
<https://svn.code.sf.net/p/pure-data/svn/trunk/externals/loaders/tclpd/tclpd.c>
[pdlua]
<https://svn.code.sf.net/p/pure-data/svn/trunk/externals/loaders/pdlua/src/pdlua.c>

PS: we probably should move these to gitlab :-)

_______________________________________________
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev