public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Andrew Schulman <schulman.andrew@epa.gov>
To: cygwin@cygwin.com
Subject: Re: libargp: argp_program_version does not work
Date: Thu, 11 Jul 2013 16:35:00 -0000	[thread overview]
Message-ID: <u4ett8due4p6h9ku1iumscvulp0g688tgk@4ax.com> (raw)
In-Reply-To: <000001ce7e08$2b866830$82933890$%fedin@samsung.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

  reply	other threads:[~2013-07-11 15:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-11 10:17 Fedin Pavel
2013-07-11 16:35 ` Andrew Schulman [this message]
2013-07-11 22:02   ` Andrew Schulman
2013-07-12 14:52     ` Fedin Pavel
2013-07-12 15:36       ` Andrew Schulman
2013-07-17  9:57         ` [PATCH] Fix optional variables in libargp Fedin Pavel
2013-07-17 12:59           ` Eric Blake
2013-07-22  7:33           ` Andrew Schulman
2013-07-22  8:12             ` Pavel Fedin
2013-07-22 13:19             ` Pavel Fedin
2013-07-23 15:07               ` Andrew Schulman
2013-07-24  9:56                 ` Pavel Fedin
2022-02-18 13:30               ` Andrew Schulman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=u4ett8due4p6h9ku1iumscvulp0g688tgk@4ax.com \
    --to=schulman.andrew@epa.gov \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).