About crtdbg.h; in my project I'm currently working on I'm using the following
link test to check whether functions from crtdbg.h can be used:
```
#ifndef _DEBUG
#define _DEBUG
#endif
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
int main(void) {
void *mem = malloc(1);
free (mem);
return 0;
}
```
Defining `_CRTDBG_MAP_ALLOC` makes crtdbg.h map malloc into _malloc_dbg and
free into _free_dbg. Link will fail for non-debug CRTs. However, some
OS-specific versions of msvcrt.dll provide those debug symbols which either do
nothing or act as non-debug version (e.g. malloc).
Also, I see usage of AC_NO_EXECUTABLES in winpthreads' configure.ac. I do not
fully understand its effect, can it affect this link test?
- Kirill Makurin
________________________________
From: Martin Storsj? <[email protected]>
Sent: Thursday, October 2, 2025 9:32 PM
To: [email protected]
<[email protected]>
Subject: Re: [Mingw-w64-public] [V2] winpthreads: integrate tests from
tests_pthread directory with Automake
On Thu, 2 Oct 2025, Kirill Makurin wrote:
> Now that I think about it, I would like to clean up the tests before
> adding test coverage for MSVC. Take for example custom definitions of
> assert, gmtime_r and localtime_t in test.h. Also, these tests haven't
> been updated in about 12 years.
That's totally reasonable; getting the tests running and covered in any CI
setup at all is a good first step anyway.
> Also, since winpthreads is Windows-specific, maybe we could also make
> use of crtdbg.h for builds with debug CRT?
Maybe, even though that's not very straightforward in the mingw
configurations.
> Martin, if you're interested, I have this repo[1] which contains scripts
> to build some (mostly autotools) packages with MSVC (both cl.exe and
> clang-cl.exe). It allows to build them with different version of CRT
> (debug vs. non-debug and static vs. shared). It can be used for testing
> winpthreads with MSVC locally in the meantime.
Ok; I don't think I have bandwidth to try to look at that myself at the
moment though. :-)
// Martin
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public