This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: libargp: argp_program_version does not work
- From: Andrew Schulman <schulman dot andrew at epa dot gov>
- To: cygwin at cygwin dot com
- Date: Thu, 11 Jul 2013 11:04:59 -0400
- Subject: Re: libargp: argp_program_version does not work
- References: <000001ce7e08$2b866830$82933890$%fedin at samsung dot com>
> Hello!
>
> I have found a problem: argp_program_version string is ignored by libargp.
Hi Pavel. Thanks for reporting this. I confirm your observation. For
example, when I compile argp's example #2
(http://www.gnu.org/software/libc/manual/html_node/Argp-Example-2.html#Argp-Example-2),
the --version option doesn't work.
> I guess the problem happens because of DLL's nature. DLLs cannot contain
> unresolved symbols, so the DLL has own version of argp_program_version which
> is always initialized to NULL. There's no way to override it.
Also confirmed. argp.h declares argp_program_version as
extern const char *argp_program_version;
But gllib/argp-pv.c initializes it as
const char *argp_program_version = (const char *) 0
Whether there's a way to override that value by one declared in the user's
code, I don't know. Maybe a linker switch?
The same problem also applies to argp_program_bug_address, which is also
extern const char *.
> Is it possible to fix this somehow ? I guess it can be done if we move this
> variable to libargp.dll.a stub library. In this case, a static definition of
> this variable will be picked up from there if there's no definition in the
> program.
This is getting outside of my knowledge. A patch would be welcome.
Could someone with more C or Gnulib knowledge than me comment?
Andrew
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple