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.


_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to