Is Cygwin supposed to know _get_pgmptr?
Corinna Vinschen
corinna-cygwin@cygwin.com
Mon Feb 11 17:32:00 GMT 2019
On Feb 11 12:08, Jeffrey Walton wrote:
> Hi Everyone,
>
> I have some code that looks like so:
>
> #if defined(_WINDOWS)
> char* pgmptr = NULLPTR;
> errno_t err = _get_pgmptr(&pgmptr);
> if (err == 0 && pgmptr != NULLPTR)
> exePath = pgmptr;
> #endif
>
> The code gets the full path of the executable. It sidsteps some
> problems with finding the full path of an executable. Posix realpath
> is a little messier and has some inherent problem with path lengths.
>
> The code fails to compile with Cygwin.
>
> I am wondering if the failure is expected.
Yes. This is a Windowism which is not supported.
Use http://man7.org/linux/man-pages/man3/program_invocation_name.3.html
instead.
Corinna
--
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20190211/8c17bceb/attachment.sig>
More information about the Cygwin
mailing list