Hisham <h <at> hisham.hm> writes:

> 
> The rockspec for
> http://luarocks.org/repositories/rocks-scm/luasocket-3.0rc1-1.rockspec
> defines 0x501 (whatever that means). What do you suggest? Should
> LuaRocks automatically add -DWINVER=0x501 (or whatever number) every
> time its builtin mode calls gcc? Should this extend to other modes
> (through default CFLAGS)? What if the rockspec author wants to specify
> a different WINVER -- is this something that makes sense to be defined
> per rockspec or per build machine?

I'll try explain how i see this.
For example Starting from WinXP we get `GetProcessId`[1] function.
And if we want use this function in our source we have to define WINVER.
In `winbase.h` we have something like

  #if (_WIN32_WINNT >= 0x0501)
  ...
  WINBASEAPI
  DWORD
  WINAPI
  GetProcessId(
      __in HANDLE Process
      );
  ...
  #endif // _WIN32_WINNT >= 0x0501

But if we try use this module on Win2k we get runtime error because there no
function GetProcessPid in kernel32.dll.
User code can detect target platform at compile also testing _WIN32_WINNT macro.
So i think we should use WINVER/_WIN32_WINNT at compile time that equal to
runtime version. Manual set could work because GetProcessPid doesn't change
since winxp, but in theory if function's signature changed we get wired
runtime error instead of basic compile time error (I do not know is there
such functions).
And what about luasocket.
Luasocket use `inet_pton`[2] function. This function available since Vista.
But now luasocket use monually written stub because it set WINVER. This is
works, but i think we should use system version if it is available.
> 
> I'm worried that changing this may cause a compatibility problem with
> rockspecs that already define WINVER explicitly (such as LuaSocket).
> 

This is why i post this message on mail list.
I do not know when there good reason to set WINVER manually (except
cross-compiling when you build Win7 binary on WinXP, etc). But luarocks
build module to work on same platform.  


[1]http://msdn.microsoft.com/en-us/library/windows/desktop/ms683215%28v=vs.85%29.aspx
[2]http://msdn.microsoft.com/en-us/library/windows/desktop/cc805844%28v=vs.85%29.aspx


------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Luarocks-developers mailing list
Luarocks-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/luarocks-developers

Reply via email to