autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie: how to handle different prototypes?


From: Ralf Wildenhues
Subject: Re: Newbie: how to handle different prototypes?
Date: Thu, 23 Jun 2005 08:10:19 +0200
User-agent: Mutt/1.4.1i

Hi,

* address@hidden wrote on Wed, Jun 22, 2005 at 10:17:02PM CEST:
> I have a basic question that I couldn't find in the info docs or the
> goat book.  What's the right way to deal with a prototype for a system
> library function that differs between platforms?  I know how to check
> for headers and libraries, but don't know what the autotools way is to
> get around different prototypes.
> 
> For example, on linux the scandir prototype is:
> 
>        int scandir(const char *dir, struct dirent ***namelist,
>               int(*select)(const struct dirent *),
>               int(*compar)(const struct dirent **, const struct dirent **));
> 
> and on darwin it's:
> 
>      int
>      scandir(const char *dirname, struct dirent ***namelist,
>          int (*select)(struct dirent *),
>          int (*compar)(const void *, const void *));
> 
> I.e. the const is missing from darwin's 3rd parameter.

Can't you just ignore this difference in your program?  If you pass a
select function which eats a const argument, you are within ANSI C
bounds in either case.  Ignore the warning some compiler may emit --
it should rather be fixed.

If you ever encounter significant function definition differences, you
may look at the chapter
  info Autoconf 'Library Functions'
of the manual and the corresponding implementations in
autoconf/function.m4 to search for a macro similar to your needs which
you can adjust.  Be sure to use published macros only within your macro.

Regards,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]