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:
make CSYM=lsl_inlet current=pd_nt
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).
I know that Miller does this it this way all the time, e.g. d_arithmetic.c. Any suggestions?
Below is my makefile, in case that helps.
Cheers,
David
NAME = lsl_io #CSYM = lsl_inlet
# this is the UNIX-style complicated layout dir, simple goes to $(prefix)/pd #prefix = /usr/local #libpddir = $(prefix)/lib/pd
.PHONY:
#current: pd_nt
# ----------------------- Microsoft Visual C ----------------------- MSCC = cl MSLN = link
pd_nt: $(NAME).dll
.SUFFIXES: .dll
PDNTCFLAGS = -W3 -WX -DNT -DPD -nologo -D_CRT_SECURE_NO_WARNINGS
-D_CRT_NONSTDC_NO_DEPRECATE
VC = "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC"
VSTK = "C:\Program Files\Microsoft SDKs\Windows\v6.0A"
PDNTINCLUDE = -I. -I$(VC)\include -I$(VSTK)\include
PDNTLDIR = $(VC)\lib
PDNTLIB = -NODEFAULTLIB:libcmt -NODEFAULTLIB:oldnames
-NODEFAULTLIB:kernel32
-NODEFAULTLIB:uuid
$(PDNTLDIR)\libcmt.lib $(PDNTLDIR)\oldnames.lib
$(VSTK)\lib\kernel32.lib $(VSTK)\lib\uuid.lib
.\pd.lib .\liblsl32.lib
.c.dll: $(MSCC) $(PDNTCFLAGS) $(PDNTINCLUDE) -c $*.c $(MSLN) -nologo -dll -export:$(CSYM)_setup $*.obj $(PDNTLIB)
# ----------------------- LINUX i386 -----------------------
pd_linux: $(NAME).pd_linux
.SUFFIXES: .pd_linux
LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer -fPIC
-Wall -W -Wshadow -Wstrict-prototypes
-Wno-unused -Wno-unused-parameter -Wno-parentheses -Wno-switch
$(CFLAGS) $(MORECFLAGS)
LINUXINCLUDE = -I../../src
.c.pd_linux: $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c $(CC) -shared -o $*.pd_linux $*.o -lc -lm rm -f $*.o
hello
Several pd libraries produce only one library binary which declares all the externals when loaded. But none is using the standard makefile afaik. Gem and zexy use automake to generate their own Makefiles. Jamoma and Ossia uses CMake do to the same. And I think its possible with https://github.com/pure-data/pd-lib-builder. On my side, I have one .c/.cpp file per external, in which I have a setup() method (i.e. https://github.com/OSSIA/libossia/blob/master/OSSIA/ossia-pd/src/parameter.c... ) This method is called in the library initialisation (i.e. https://github.com/OSSIA/libossia/blob/master/OSSIA/ossia-pd/src/ossia-pd.cp... ) thus Pd knows it should call parameter_new() method when you write "ossia.param" in a new object box. 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).
Cheers
Antoine
-- do it yourself http://antoine.villeret.free.fr
2017-05-12 14:37 GMT+02:00 David Medine dmedine@ucsd.edu:
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:
make CSYM=lsl_inlet current=pd_nt
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).
I know that Miller does this it this way all the time, e.g. d_arithmetic.c. Any suggestions?
Below is my makefile, in case that helps.
Cheers,
David
NAME = lsl_io #CSYM = lsl_inlet
# this is the UNIX-style complicated layout dir, simple goes to $(prefix)/pd #prefix = /usr/local #libpddir = $(prefix)/lib/pd
.PHONY:
#current: pd_nt
# ----------------------- Microsoft Visual C ----------------------- MSCC = cl MSLN = link
pd_nt: $(NAME).dll
.SUFFIXES: .dll
PDNTCFLAGS = -W3 -WX -DNT -DPD -nologo -D_CRT_SECURE_NO_WARNINGS
-D_CRT_NONSTDC_NO_DEPRECATE VC = "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC" VSTK = "C:\Program Files\Microsoft SDKs\Windows\v6.0A"PDNTINCLUDE = -I. -I$(VC)\include -I$(VSTK)\include
PDNTLDIR = $(VC)\lib PDNTLIB = -NODEFAULTLIB:libcmt -NODEFAULTLIB:oldnames -NODEFAULTLIB:kernel32
-NODEFAULTLIB:uuid
$(PDNTLDIR)\libcmt.lib $(PDNTLDIR)\oldnames.lib
$(VSTK)\lib\kernel32.lib $(VSTK)\lib\uuid.lib
.\pd.lib .\liblsl32.lib.c.dll: $(MSCC) $(PDNTCFLAGS) $(PDNTINCLUDE) -c $*.c $(MSLN) -nologo -dll -export:$(CSYM)_setup $*.obj $(PDNTLIB)
# ----------------------- LINUX i386 -----------------------
pd_linux: $(NAME).pd_linux
.SUFFIXES: .pd_linux
LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer -fPIC
-Wall -W -Wshadow -Wstrict-prototypes
-Wno-unused -Wno-unused-parameter -Wno-parentheses -Wno-switch
$(CFLAGS) $(MORECFLAGS)LINUXINCLUDE = -I../../src
.c.pd_linux: $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c $(CC) -shared -o $*.pd_linux $*.o -lc -lm rm -f $*.o
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li stinfo/pd-list