On Saturday 08 October 2022 23:57:06 LIU Hao wrote:
> 在 2022-10-08 21:15, Pali Rohár 写道:
> > 
> > Is not _CRTIMP automatically marking variable with dllimport and
> > instruct compiler to convert variable name to __imp_name* pointer?
> 
> Not always, at least. When building the CRT itself, where `_CRTBLD` is
> defined, `_CRTIMP` is defined as empty. I am unclear about the reason
> though, but that's it.

Ok, I see.

Anyway, I quite do not understand why some crt exported functions are
marked with _CRTIMP (as it is empty during CRT build) and some exported
variables use __MINGW_IMP_SYMBOL. I would expect that all exported
functions and variables (from dll) would use same "syntax" and same
"behavior". Is not this a bug?

And why is not used directly __desclspec(dllimport)? I think that
specifying dllimport is same as using __MINGW_IMP_SYMBOL and then
defining a new macro with pointer dereferencing of defined symbol.
Or not and is there something special why "more complicated" approach
via __MINGW_IMP_SYMBOL is required?

Please do not take me wrong (for maybe stupid questions), I'm just
trying to understand how it works and why it is written in this way.


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to