I fail to see how it could work properly the way it was, on any
platform. The main component in Squid referencing malloc functions is
libmiscutil, and libraries must be included after their first use..
However, I seriously doubt that moving it behind XTRA_LIBS is a good
idea. XTRA_LIBS may well contain other malloc implementations on some
platforms, and those would then override dlmalloc.
Unix link libraries is a simple left to right dependency where
objects/libraries to the left can replace libraries to the right, but
objects/libraries to the right cannot cause additional objects the be
used from libraries to the left.
This is why one must write
gcc file.c -lm
and not
gcc -lm file.c
and also why in
-lfirstlib -lsecondlib
firstlib can make use of functions in secondlib, but secondlib cannot
make use of functions in firstlib unless these are first used by
something to the left of -lfirstlib.
When overriding library functions with another library this gets much
more delicate, and care must be taken to make sure that all the
overridden functions have their objects referenced prior to the
inclusion of the overriding library.
I have had to deal with this sticky mess in another project where a
circular dependency between two libraries existed and one of the
libraries had multiple implementations for different uses. Not a plecant
task to clean up, even if it was originally created by yours truly..
still haven't found the best approach there as the whole design is
self-referencing with a interchangeable layer in the middle. But that is
mine problem and not yours..
/Henrik
Duane Wessels wrote:
>
> I found that using --enable-dlmalloc on FreeBSD is not sufficient to
> make squid link with the dlmalloc code. There is some dependency with
> the order of the libraries. I had to make this change to use dlmalloc:
>
> Index: Makefile.in
> ===================================================================
> RCS file: /server/cvs-server/squid/squid/src/Makefile.in,v
> retrieving revision 1.195
> diff -u -r1.195 Makefile.in
> --- Makefile.in 2000/10/20 23:50:59 1.195
> +++ Makefile.in 2000/11/06 18:13:59
> @@ -76,7 +76,7 @@
> INCLUDE = -I. -I../include -I$(top_srcdir)/include
> CFLAGS = $(AC_CFLAGS) $(INCLUDE) $(DEFINES)
> SQUID_LIBS = -L../lib $(CRYPTLIB) $(REGEXLIB) @SQUID_PTHREAD_LIB@ \
> - $(SNMPLIB) $(MALLOCLIB) -lmiscutil $(XTRA_LIBS)
> + $(SNMPLIB) -lmiscutil $(XTRA_LIBS) $(MALLOCLIB)
> CLIENT_LIBS = -L../lib -lmiscutil $(XTRA_LIBS)
> DNSSERVER_LIBS = -L../lib -lmiscutil $(XTRA_LIBS)
> PINGER_LIBS = -L../lib -lmiscutil $(XTRA_LIBS)
>
> Can anyone forsee problems with this change?
Received on Mon Nov 06 2000 - 16:28:01 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:56 MST