Re: [Mingw-w64-public] [RFC PATCH] headers: Simplify _HUGE definition

2022-10-10 Thread LIU Hao
在 2022/10/11 05:20, Martin Storsjö 写道: On Mon, 10 Oct 2022, Pali Rohár wrote: Anyway, why exported functions are defined via _CRTIMP? Should not be also be defined via __MINGW_IMP_SYMBOL/dllimport to avoid generating unnecessary thunk/wrapper for mingw-w64 runtime code? I think it's a matter

Re: [Mingw-w64-public] [RFC PATCH] headers: Simplify _HUGE definition

2022-10-10 Thread Martin Storsjö
On Mon, 10 Oct 2022, Pali Rohár wrote: On Monday 10 October 2022 14:25:07 Martin Storsjö wrote: But when building code within mingw-w64-crt, _CRTIMP expands to nothing. I guess this is generally desireable when implementing some of the functions that are marked _CRTIMP (we generally shouldn't

Re: [Mingw-w64-public] [RFC PATCH] headers: Simplify _HUGE definition

2022-10-10 Thread Pali Rohár
On Monday 10 October 2022 14:25:07 Martin Storsjö wrote: > Historically, the _CRTIMP macro comes from how it is used in upstream > msvcrt; you can link the CRT either statically or dynamically. If intending > to link statically, _CRTIMP expands to nothing, while if intending to link > dyanmically,

Re: [Mingw-w64-public] [RFC PATCH] headers: Simplify _HUGE definition

2022-10-10 Thread LIU Hao
在 2022/10/10 19:25, Martin Storsjö 写道: I think this example kinda misses the point; here you already do have an __imp__tzset elsewhere (from the import library) - but we only do manually define e.g. __imp__tzset when we're in a configuration where the import library doesn't provide it (or we'v

Re: [Mingw-w64-public] [RFC PATCH] headers: Simplify _HUGE definition

2022-10-10 Thread Martin Storsjö
On Sun, 9 Oct 2022, LIU Hao wrote: 在 2022/10/9 18:05, Pali Rohár 写道: 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 func

Re: [Mingw-w64-public] [RFC PATCH] headers: Simplify _HUGE definition

2022-10-09 Thread LIU Hao
在 2022/10/9 18:05, Pali Rohár 写道: 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

Re: [Mingw-w64-public] [RFC PATCH] headers: Simplify _HUGE definition

2022-10-09 Thread Pali Rohár
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 `_

Re: [Mingw-w64-public] [RFC PATCH] headers: Simplify _HUGE definition

2022-10-08 Thread LIU Hao
在 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 ab

Re: [Mingw-w64-public] [RFC PATCH] headers: Simplify _HUGE definition

2022-10-08 Thread Pali Rohár
On Saturday 08 October 2022 20:07:56 LIU Hao wrote: > 在 2022/10/8 19:10, Pali Rohár 写道: > > _HUGE global variable is available and exported from crtdll and msvcrt > > libraries. So declare it explicitly via _CRTIMP as global variable and not > > via __MINGW_IMP_SYMBOL pointer. > > --- > > I suspec

Re: [Mingw-w64-public] [RFC PATCH] headers: Simplify _HUGE definition

2022-10-08 Thread LIU Hao
在 2022/10/8 19:10, Pali Rohár 写道: _HUGE global variable is available and exported from crtdll and msvcrt libraries. So declare it explicitly via _CRTIMP as global variable and not via __MINGW_IMP_SYMBOL pointer. --- I suspect you are linking to the `_HUGE` in 'math/_huge.c'. I'm really not s

[Mingw-w64-public] [RFC PATCH] headers: Simplify _HUGE definition

2022-10-08 Thread Pali Rohár
_HUGE global variable is available and exported from crtdll and msvcrt libraries. So declare it explicitly via _CRTIMP as global variable and not via __MINGW_IMP_SYMBOL pointer. --- I'm really not sure what was the reason to define _HUGE via macro __MINGW_IMP_SYMBOL poinster. So maybe there is a re