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

IOhannes m zmoelnig zmoelnig at iem.at
Mon Oct 31 09:53:45 CET 2011


-----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.

> 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"

mfgasdr
IOhannes
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6uYhQACgkQkX2Xpv6ydvQXKwCg8aASpKApdG7MLDffKHtlrWF8
JTQAoJ7CrewiC49OnefL2oKyL9bsCM34
=yPTG
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Makefile.diff
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20111031/c550c6ff/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3636 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20111031/c550c6ff/attachment-0001.bin>


More information about the Pd-dev mailing list