[PD-dev] how to load shared code for libraries

Hans-Christoph Steiner hans at at.or.at
Mon Oct 31 15:35:44 CET 2011


On Oct 31, 2011, at 4:53 AM, IOhannes m zmoelnig wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 2011-10-30 22:41, Hans-Christoph Steiner wrote:
>> 
>> Having the name SHARED_SOURCE singular highlights that its a single file, which I think it should be.  But since its an internal variable, I would be OK with it having a different name.
> 
> i really cannot understand, why SHARED_SOURCE _should_ only be a single
> file. do you have any reference that claims that single-file libraries
> are somewhat "superior" (e.g. less confusing to the casual onlooker)?
> 
> anyhow...
> 
>> 
>> I don't see a gain to making it multiple files, unless you are doing something very complicated, in which case, you'll need to customize the Makefile.  At that point, the Makefile is easy enough to read for someone who does Makefiles, so they don't need it documented.
>> 
>>> - - standardize the shared library name to lib$(LIBNAME).$(EXT)
>>> 
>>> that is all.
>>> 
>> It already is:
>> 
>> SHARED_SOURCE ?= $(wildcard lib$(LIBRARY_NAME).c)
>> SHARED_HEADER ?= $(shell test ! -e $(LIBRARY_NAME).h || echo $(LIBRARY_NAME).h)
>> SHARED_LIB = $(SHARED_SOURCE:.c=.$(SHARED_EXTENSION))
> 
> not really.
> SHARED_LIB is generated by replacing all ".c" extension by
> ".$(SHARED_EXTENSION) within SHARED_SOURCE, which is a space delimited
> list of tokens.
> your SHARED_SOURCE happens to consist only of a single token, but at the
> same time it is settable by the user (and indeed documents that it could
> be overridden by the use of "?=")
> 
> whereas LIBRARY_NAME is documented to be a single name (well i thought
> so; i cannot find any reference to this either)
> 
> if we leave variable names as they are, my proposed change is a
> one-liner (see attachment)
> 
> 
>> SHARED_TCL_LIB = $(wildcard lib$(LIBRARY_NAME).tcl)
> 
> does this already do anything?
> it seems like the only use of SHARED_TCL_LIB is within the "showsetup"
> target.


Oops, messed that one up.  It now works. Thanks for catching that.


>> I figured you'd want something more complicated, so I put in the ?= for you.  Like before with ALL_*, take the template and modify it for your library. If its implemented in a way that still meets the goal of a simple interface, I'll merge it in.
> 
> ah, we should create some code for me to say "this is _really_ a simple
> change"

You should create some code that solves your issue in your library.  Then we'll take it from there.

.hc

----------------------------------------------------------------------------

All mankind is of one author, and is one volume; when one man dies, one chapter is not torn out of the book, but translated into a better language; and every chapter must be so translated.... -John Donne 





More information about the Pd-dev mailing list