In am attempt to figure out if malloc()
in my cross-compiled mingw32 program is threadsafe or not, I ran nm
on the binary. The results:
$ i386-mingw32-nm myfile.exe | grep malloc
00ab04fc I __imp__malloc
005b8e70 T _malloc
$
For comparison, here is a search for GetLastError
, which is used but not defined in my program:
$ i386-mingw32-nm myfile.exe | grep GetLastError
005b9034 T _GetLastError@0
00ab0370 I __imp__GetLastError@0
$
And here is a search for something I know is in my program:
$ i386-mingw32-nm myfile.exe | grep ends_with
0040a98d T _ends_with
$
I think that this means that malloc()
in my C library is provided as a cover to a system malloc()
, as is GetLastError()
, but that ends_with()
doesn't appear in the system. But I'd like a second opinion.
Thanks!
mingw does not use its own malloc
, it links the Windows malloc
. So yes, it is threadsafe, because Windows is.