bug-gnulib
[Top][All Lists]
Advanced

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

Re: [bug-gnulib] Re: check_version


From: Bruno Haible
Subject: Re: [bug-gnulib] Re: check_version
Date: Mon, 11 Jul 2005 13:28:37 +0200
User-agent: KMail/1.5

Simon Josefsson wrote:
> +const char *
> +check_version (const char *req_version)
> +{
> +  if (!req_version || strverscmp (req_version, VERSION) < 0)
> +    return VERSION;
> +
> +  return NULL;
> +}
> ...
> You will typically wrap the call to the
> `check_version' function through a library API, your library header
> file may contain:
> 
>      #define STRINGPREP_VERSION "0.5.18"
>      ...
>        extern const char *stringprep_check_version (const char *req_version);
> 
>    The implementation of `stringprep_check_version' would simply pass
> on the call to `check_version'.

This makes it impossible to have more than one package using the check_version
function. Say, stringprep and libiconv want to use the check_version
function. On an ELF system, only one of the two copies of it can persist.
Such that a call to stringprep_check_version would end up comparing with
libiconv's version, or vice versa. And on non-ELF systems, you could get
a linker error.

I see only one way out: Recommend to use a config.h that does
  #define stringprep_check_version check_version
instead of a function that calls check_version.

Bruno





reply via email to

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