Does the Microsoft header include math.h?
Hi,
Does the Microsoft header include math.h?
I'm sorry, it seems I made a mistake here: the actual header file (d3dx9math.h) from wine includes math.h so the sqrt usage is ok.
However, d3dx9math.inl also uses min and max macros which aren't included anywhere. Because of this a winelib user has to define/include those symbols before including d3dx9math.h (that was my original problem). I'm pretty certain that is not the case for the Microsoft headers.
A quick grep of the wine include files shows that the min/max macros are defined in windef.h, minmax.h and msvcrt/stdlib.h - I have no idea which one should be included here.
Again, sorry for the bogus patch and thanks for the quick response.
Cheers, Daniel Scharrer
Am 10.11.2011 19:02, schrieb Daniel Scharrer:
Hi,
Does the Microsoft header include math.h?
I'm sorry, it seems I made a mistake here: the actual header file (d3dx9math.h) from wine includes math.h so the sqrt usage is ok.
However, d3dx9math.inl also uses min and max macros which aren't included anywhere. Because of this a winelib user has to define/include those symbols before including d3dx9math.h (that was my original problem). I'm pretty certain that is not the case for the Microsoft headers.
A quick grep of the wine include files shows that the min/max macros are defined in windef.h, minmax.h and msvcrt/stdlib.h - I have no idea which one should be included here.
Again, sorry for the bogus patch and thanks for the quick response.
Cheers, Daniel Scharrer
It seems to me that native d3dx9math.h doesn't use min/max, it uses a normal comparison, not the macro. I think the better fix would be to replace the min/max in wine's d3dx9math.inl.
Cheers Rico
On Thu, 10 Nov 2011, Daniel Scharrer wrote:
Does the Microsoft header include math.h?
I'm sorry, it seems I made a mistake here: the actual header file (d3dx9math.h) from wine includes math.h so the sqrt usage is ok.
However, d3dx9math.inl also uses min and max macros which aren't included anywhere. Because of this a winelib user has to define/include those symbols before including d3dx9math.h (that was my original problem). I'm pretty certain that is not the case for the Microsoft headers.
A quick grep of the wine include files shows that the min/max macros are defined in windef.h, minmax.h and msvcrt/stdlib.h - I have no idea which one should be included here.
At least up to DirectX 9.0c, d3dx9math.h only includes d3dx9.h and math.h (and d3dx9math.inl) so that's what we have to work with. But as has been pointed out previously, in DirectX 9.0c d3dx9math.inl does not use min() and max(). So removing them from our version is probably the right fix.
On Fri, Nov 11, 2011 at 12:45, Francois Gouget fgouget@free.fr wrote:
On Thu, 10 Nov 2011, Daniel Scharrer wrote:
Does the Microsoft header include math.h?
I'm sorry, it seems I made a mistake here: the actual header file (d3dx9math.h) from wine includes math.h so the sqrt usage is ok.
However, d3dx9math.inl also uses min and max macros which aren't included anywhere. Because of this a winelib user has to define/include those symbols before including d3dx9math.h (that was my original problem). I'm pretty certain that is not the case for the Microsoft headers.
A quick grep of the wine include files shows that the min/max macros are defined in windef.h, minmax.h and msvcrt/stdlib.h - I have no idea which one should be included here.
At least up to DirectX 9.0c, d3dx9math.h only includes d3dx9.h and math.h (and d3dx9math.inl) so that's what we have to work with. But as has been pointed out previously, in DirectX 9.0c d3dx9math.inl does not use min() and max(). So removing them from our version is probably the right fix.
Ok, I've submitted a new patch that removes min/max usage in d3dx9math.inl.
Cheers, Daniel