Hi Xavi,
>> I don't see any need for a make-level solution. All macros can
>> be defined from source. Why is it better to define them on
>> make level?
>
> Because if someone tries to compile Harbour with a version of SDK not
> supported, he don't have compile-time error.
> If in the example of my previous thread post I protect IP_ADAPTER_ADDRESSES
> use with .-
> #if _WIN32_WINNT >= 0x0501
> ...
> #endif
_WIN32_WINNT holds the version we want to _target_.
So there is no point in using it as a guard, since
it doesn't hold the maximum supported target version
of the C compiler/SDK.
So you need to do this:
1) You detect if the feature is supported on
given target compiler. (for this you may
need to use __MINGW32__ and _MSC_VER, or
NTDDI_VERSION) (there is no way to do this,
or to do this better on the make level)
2) You enable the feature by locally redefining
_WIN32_WINNT (or, if this feature is a missing
macro, you define them locally)
3) Then you make the call. If the call is present
in all Windows versions starting Win95, you
make it regular call, if not, you make it
dynamic.
F.e. in above case, you can do this:
---
#define _WIN32_WINNT >= 0x0501
#include <windows.h>
[...]
#if defined( IP_ADAPTER_ADDRESSES)
[...]
#endif
---
or, in case you want to make it fully dynamic:
---
#include <windows.h>
#ifndef IP_ADAPTER_ADDRESSES
#define IP_ADAPTER_ADDRESSES 0x00020 /* change this to real value */
#endif
[...]
if( hbwin_version() > 0x???? ) /* detect if we're running under Windows version
which supports IP_ADAPTER_ADDRESS.
{
[...]
}
---
Sorry, but I still cannot see what the make system
has to do with this.
Brgds,
Viktor
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour