[PATCH] Fix optional variables in libargp

Andrew Schulman schulman.andrew@epa.gov
Fri Feb 18 13:30:05 GMT 2022

>  Hello!
>  I have successfully tested it on i386. Really, just remove PREFIX
> completely and it's okay. GetProcAddress() appears to be "clever" and adds
> the leading underscope by itself on i386. I don't know what you did wrong
> and why you could not reproduce the solution.
>  However, i have one idea. After patching libargp you need to recompile your
> test case. Because it needs to pick up __declspec(dllexport).

Yes, I recompiled my example after rebuilding and reinstalling libargp.  It
still doesn't work.  I even rebooted too, to make sure I was using the
newly installed cygargp-0.dll and not a cached version.

I don't know why this should work for you, and not for me.  I'm attaching
here the revised patch of yours with PREFIX removed, and the argp-ex2.c
source file that I'm building.  Using this patch, I rebuild and reinstall
libargp.   Then I get

$ gcc -o argp-ex2 argp-ex2.c -largp
$ ./argp-ex2.exe --help
Usage: argp-ex2 [OPTION...]
Argp example #2 -- a pretty minimal program using argp

  -?, --help                 give this help list
      --usage                give a short usage message

Note there's no --version option or bug reporting email address.  Do you
get a different result?

More information about the Cygwin mailing list