* Is Cygwin supposed to know _get_pgmptr?
@ 2019-02-11 17:09 Jeffrey Walton
2019-02-11 17:32 ` Corinna Vinschen
0 siblings, 1 reply; 2+ messages in thread
From: Jeffrey Walton @ 2019-02-11 17:09 UTC (permalink / raw)
To: cygwin
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.
Jeff
--
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Is Cygwin supposed to know _get_pgmptr?
2019-02-11 17:09 Is Cygwin supposed to know _get_pgmptr? Jeffrey Walton
@ 2019-02-11 17:32 ` Corinna Vinschen
0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2019-02-11 17:32 UTC (permalink / raw)
To: Jeffrey Walton; +Cc: cygwin
[-- Attachment #1: Type: text/plain, Size: 790 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-02-11 17:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-11 17:09 Is Cygwin supposed to know _get_pgmptr? Jeffrey Walton
2019-02-11 17:32 ` Corinna Vinschen
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).