The NVIDIA® Tools Extension SDK (NVTX) is a C-based Application Programming Interface (API) for annotating events, code ranges, and resources in your applications.
Apache License 2.0
310
stars
48
forks
source link
Fix Windows build when WIN32_LEAN_AND_MEAN is defined by always including stdlib.h (nvbug 200683304) #84
#define WIN32_LEAN_AND_MEAN
#include <nvtx3/nvToolsExt.h>
int main() {}
outputs
1>...\include\nvtx3\nvtxDetail\nvtxInit.h(164,32): error C3861: '_wgetenv': identifier not found
Normally, #include <Windows.h> in nvtxImpl.h would include <stdlib.h> — unless WIN32_LEAN_AND_MEAN is defined. In that case, nothing defines _wgetenv. This pull request should fix that by moving #include <stdlib.h> out of the Linux-only preprocessor branch.
This fixes the bug where this code:
outputs
Normally,
#include <Windows.h>
in nvtxImpl.h would include<stdlib.h>
— unlessWIN32_LEAN_AND_MEAN
is defined. In that case, nothing defines_wgetenv
. This pull request should fix that by moving#include <stdlib.h>
out of the Linux-only preprocessor branch.Thanks!