[flang-commits] [flang] [flang] GETPID runtime and lower intrinsic implementation (PR #70442)

David Truby via flang-commits flang-commits at lists.llvm.org
Mon Nov 6 06:37:31 PST 2023


================
@@ -15,6 +15,18 @@
 #include <cstdlib>
 #include <limits>
 
+#ifdef _WIN32
+#define WIN32_LEAN_AND_MEAN
+#define NOMINMAX
+#include <windows.h>
+
+// On Windows GetCurrentProcessId returns a DWORD aka uint32_t
+#include <processthreadsapi.h>
+#define getpid GetCurrentProcessId
----------------
DavidTruby wrote:

I noticed in an intermediate version of this patch you changed this to an inline function, did that not work for some reason? I'd prefer it that way if it works, I think using a macro like this is really fragile.

https://github.com/llvm/llvm-project/pull/70442


More information about the flang-commits mailing list