<div dir="ltr">hello <div><br></div><div>Several pd libraries produce only one library binary which declares all the externals when loaded.</div><div>But none is using the standard makefile afaik.</div><div>Gem and zexy use automake to generate their own Makefiles.</div><div>Jamoma and Ossia uses CMake do to the same.</div><div>And I think its possible with <a href="https://github.com/pure-data/pd-lib-builder">https://github.com/pure-data/pd-lib-builder</a>.</div><div>On my side, I have one .c/.cpp file per external, in which I have a setup() method (i.e. <a href="https://github.com/OSSIA/libossia/blob/master/OSSIA/ossia-pd/src/parameter.cpp#L224-L256">https://github.com/OSSIA/libossia/blob/master/OSSIA/ossia-pd/src/parameter.cpp#L224-L256</a>)</div><div>This method is called in the library initialisation (i.e. <a href="https://github.com/OSSIA/libossia/blob/master/OSSIA/ossia-pd/src/ossia-pd.cpp#L42">https://github.com/OSSIA/libossia/blob/master/OSSIA/ossia-pd/src/ossia-pd.cpp#L42</a>)</div><div>thus Pd knows it should call parameter_new() method when you write "ossia.param" in a new object box.</div><div>And the library setup is called when you start pd with '-lib libname' option, or when you add a '[libname]' (but you should provide the right new function returning an object pointer to  handle that).</div><div><br></div><div>Cheers</div><div><br></div><div>Antoine</div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">--<br>do it yourself                       <br><a href="http://antoine.villeret.free.fr" target="_blank">http://antoine.villeret.free.fr</a><br></div></div>
<br><div class="gmail_quote">2017-05-12 14:37 GMT+02:00 David Medine <span dir="ltr"><<a href="mailto:dmedine@ucsd.edu" target="_blank">dmedine@ucsd.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I am building a small suite of related externals and it would be most convenient to simply compile one .obj file and pull the externs off of it one at a time. My makefile is the standard Pd makefile, but I leave the CSYM and current fields empty so I can declare them with my call to make:<br>
<br>
>> make CSYM=lsl_inlet current=pd_nt<br>
<br>
It builds just fine, but when I open the help patch, the extern doesn't load. If, I rename the file and arrange things so that the filename is the same as the extern name (i.e. there is only one extern per .obj) and recompile it works just fine. The important point is that I don't change the code or the body of the makefile at all (except for the NAME field).<br>
<br>
I know that Miller does this it this way all the time, e.g. d_arithmetic.c. Any suggestions?<br>
<br>
Below is my makefile, in case that helps.<br>
<br>
Cheers,<br>
<br>
David<br>
<br>
<br>
NAME = lsl_io<br>
#CSYM = lsl_inlet<br>
<br>
# this is the UNIX-style complicated layout dir, simple goes to $(prefix)/pd<br>
#prefix = /usr/local<br>
#libpddir = $(prefix)/lib/pd<br>
<br>
.PHONY:<br>
<br>
#current: pd_nt<br>
<br>
<br>
# ----------------------- Microsoft Visual C -----------------------<br>
MSCC = cl<br>
MSLN = link<br>
<br>
pd_nt: $(NAME).dll<br>
<br>
.SUFFIXES: .dll<br>
<br>
PDNTCFLAGS = -W3 -WX -DNT -DPD -nologo -D_CRT_SECURE_NO_WARNINGS \<br>
    -D_CRT_NONSTDC_NO_DEPRECATE<br>
VC = "C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC"<br>
VSTK = "C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A"<br>
<br>
PDNTINCLUDE = -I. -I$(VC)\\include -I$(VSTK)\\include<br>
<br>
PDNTLDIR = $(VC)\\lib<br>
PDNTLIB = -NODEFAULTLIB:libcmt -NODEFAULTLIB:oldnames -NODEFAULTLIB:kernel32 \<br>
        -NODEFAULTLIB:uuid \<br>
    $(PDNTLDIR)\\libcmt.lib $(PDNTLDIR)\\oldnames.lib \<br>
        $(VSTK)\\lib\\kernel32.lib $(VSTK)\\lib\\uuid.lib \<br>
     .\\pd.lib .\\liblsl32.lib<br>
<br>
.c.dll:<br>
    $(MSCC) $(PDNTCFLAGS) $(PDNTINCLUDE) -c $*.c<br>
    $(MSLN) -nologo -dll -export:$(CSYM)_setup $*.obj $(PDNTLIB)<br>
<br>
# ----------------------- LINUX i386 -----------------------<br>
<br>
pd_linux: $(NAME).pd_linux<br>
<br>
.SUFFIXES: .pd_linux<br>
<br>
LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer -fPIC \<br>
    -Wall -W -Wshadow -Wstrict-prototypes \<br>
    -Wno-unused -Wno-unused-parameter -Wno-parentheses -Wno-switch \<br>
    $(CFLAGS) $(MORECFLAGS)<br>
<br>
LINUXINCLUDE =  -I../../src<br>
<br>
.c.pd_linux:<br>
    $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c<br>
    $(CC) -shared -o $*.pd_linux $*.o -lc -lm<br>
    rm -f $*.o<br>
<br>
<br>
______________________________<wbr>_________________<br>
<a href="mailto:Pd-list@lists.iem.at" target="_blank">Pd-list@lists.iem.at</a> mailing list<br>
UNSUBSCRIBE and account-management -> <a href="https://lists.puredata.info/listinfo/pd-list" rel="noreferrer" target="_blank">https://lists.puredata.info/li<wbr>stinfo/pd-list</a><br>
</blockquote></div><br></div>