I'm not sure this is a good idea because other functions might be pulled from malloc.h, or malloc() might be find in yet another header. It's nearly impossible to know, you would need to be familiar with every system function used by libltdl and where it resides on every system known to man. I think it is sufficient to do this without the error message. Really, I can't be sure that making the change from including both to including stdlib.h only won't break some system somewhere, but it probably won't.
Robert -----Original Message----- From: Dalibor Topic [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 5:19 AM To: Bob Friesenhahn Cc: Boehne, Robert; [EMAIL PROTECTED] Subject: Re: Fixing malloc.h related warning 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