On 27.08.2024 23:35, Pali Rohár wrote:
On Tuesday 27 August 2024 23:20:23 Jacek Caban wrote:
On 27.08.2024 21:16, Pali Rohár wrote:
+/* define just import symbol, function itself is in crtexe.c and crtdll.c
files */
+int (__cdecl *__MINGW_IMP_SYMBOL(atexit))(void (__cdecl *)(void)) = atexit;
The patch looks mostly good to me, but do we need this __imp_ symbol at all?
We already declare it without dllimport in the header.
Thanks,
Jacek
I thought that it is a good idea to provide __imp_ symbol for every
function which is originally available in DLL library. Reason is that it
is not required to use declarations from mingw-w64 header files and it is
possible to define own function declarations (with dllimport attribute)
or use object files compiled by msvc compiler.
When writing own declaration of function which is in external DLL
library, it is common to mark function as dllimport. And "atexit"
function looks like it can be in external DLL library.
In any case, this __imp_ symbol is in separate object file in .a
library, so should not cause any issues if the __imp_ symbol is not used
at all. Linker should not include it into final binary if is unused.
I think this is a step backwards from UCRT point of view. Right now if
user makes such a mistake, it gets diagnostics from the linker (an error
with binutils or a warning with LLD), while with this patch it will be
silently accepted. I think that implementing local imports in binutils
would be a better approach.
Anyway, it's not a big deal, feel free to ignore.
Jacek
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public