/* Name and version of program. */
-/* ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; */ // not this simple for C++
+ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
/* Bug report address. */
ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT;
/* Parse and process arguments. */
int remaining;
- argp_program_version_hook = print_version; // this works
(void) argp_parse (&argp, argc, argv, ARGP_IN_ORDER, &remaining, NULL);
if (remaining != argc)
error (EXIT_FAILURE, 0,
argp_program_bug_address, in all programs. argp.h declares these
variables as non-const (which is correct in general). But we can
do better, it is not going to change. So we want to move them into
- the .rodata section. Define macros to do the trick. */
+ the .rodata section. Define macros to do the trick. The default
+ linkage for consts in C++ is internal, so declare them extern. */
+extern void (*const apvh) (FILE *, struct argp_state *);
#define ARGP_PROGRAM_VERSION_HOOK_DEF \
void (*const apvh) (FILE *, struct argp_state *) \
__asm ("argp_program_version_hook")
+extern const char *const apba__;
#define ARGP_PROGRAM_BUG_ADDRESS_DEF \
const char *const apba__ __asm ("argp_program_bug_address")