Bob Friesenhahn wrote:
On Mon, 15 Sep 2003, Boehne, Robert wrote:


Dalibor,

This would require a patch that looks for whatever malloc.h is #included for
in stdlib.h and prefers it in stdlib.h.  So it isn't as simple as s/malloc/stdlib/.


The question is how necessary is it to support non-ANSI C.  Stdlib.h
is ANSI C standard while malloc.h is a legacy header.  The header is
included in order to obtain prototypes for malloc() and free().  If
the compilation environment is ANSI C, malloc.h should never be
included.

Probably this is sufficient:

#if defined(HAVE_STDLIB_H)
#include <stdlib.h>
#else
#if defined(HAVE_MALLOC_H)
#include <malloc.h>
#endif
#endif

You may want to add an error message if none of the headers can be found to go sure that you don't get weird 'C compiler can't find declaration, so it makes assumptions about parameter types' problems:



#if defined(HAVE_STDLIB_H) #include <stdlib.h> #else #if defined(HAVE_MALLOC_H) #include <malloc.h> #else #error "Can not find a header declaring malloc." #endif #endif

if this is o.k., I'll submit a patch.

cheers,
dalibor topic



_______________________________________________
Libtool mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/libtool

Reply via email to