This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libargp: argp_program_version does not work

>  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
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?


Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]