[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: molehill ----> mountain
From: |
Bob Friesenhahn |
Subject: |
Re: molehill ----> mountain |
Date: |
Wed, 31 Mar 2004 18:19:59 -0600 (CST) |
On Thu, 1 Apr 2004, Gary V.Vaughan wrote:
>
> Pop quiz: libltdl is a client of xmalloc from libltdl/xalloc.c, and
> libm4
> is a client of gnulib/xmalloc.c. Both define xmalloc(), with different
> semantics, but the same prototype. m4 itself links both libraries. m4.h
> declares gnulib/xmalloc.c's xmalloc, but ltdl.h doesn't declare anything
> from libltdl/xalloc.c. What happens if m4's main() calls xmalloc()?
Hopefully the linker wouldn't even allow the link to occur due to
duplicate symbols.
> I guess you're saying that execution could end up in either :-( This is
> exactly what weak symbols are for isn't it? I imagine they are not
> portable
> enough to be used in libltdl though. Ack.
Weak symbols are not even usable for static linkage.
If you like looking at 'xmalloc' in the code, create a lt_xmalloc
function and add some defines at the top of ltdl.c to remap xmalloc to
lt_xmalloc.
Bob
======================================
Bob Friesenhahn
address@hidden
http://www.simplesystems.org/users/bfriesen
Re: 110-gary-rationalise-memory-management.patch, Bob Friesenhahn, 2004/03/31