Tom N Harris <telliamed@...> writes: > > On Thursday, August 22, 2013 06:27:28 AM Alexey Melnichuk wrote: > > When i compile some module i need to define Windows version(`WINVER` and > > `_WIN32_WINNT` macro). MinGW does not define this macro at all. I think we > > should define this macros in luarocks config. > > No. API compatibility is a function of the source code being built, not the > build system. Different sources will have different compatibility > requirements. Put the necessary compiler flags in your rockspec. If a > developer does not define the appropriate flags to make a rock build on your > system, that's a bug in the rock. It should not be LR's job to babysit poorly > constructed rocks. > > Should LuaRocks also define _POSIX_SOURCE and _LARGEFILE_SOURCE for the > convenience of Linux developers? But what if I want to use a GNU API? Now I > have to argue with LR about what compiler flags to use. > > And if a user has different compatibility requirements than the rockspec > specifies, that's what the site config is for. > > Remember, the Lua way is to provide the mechanism, not to dictate policy. So > no, doing this confuses the responsibilities of the module developer with the > responsibilities of the build system. I don't think it should be done. >
I really can not understand how i could do this. E.g. in my module i have #if _WIN32_WINNT >= _WIN32_WINNT_WINXP int process_get_pid(lua_State *L){ ... lua_pushnumber(L, GetProcessId(hProcess)); // GetProcessId is WinXP+ function return 1; } #endif This code work for ether Win2k or WinXP. But on Win2k I just do not support process_get_pid function at all. What i should write in rockspec? If i write _WIN32_WINNT=0x500 (Win2K) then my module will not have function process_get_pid even on WinXP. But if i write _WIN32_WINNT=0x501 (WinXP) then my module will not work on Win2k at all. You need define _WIN32_WINNT/WINVER _after_ you determine for which windows you compile your code. And this is not matter of what you want. You have specific API on specific version of windows and your code should work with this API or should not compile at all. On *nix system as i understand this work do `configure` script and this is build system. The problem only with global namespace. If your code use name `GetProcessId` then after defining _WIN32_WINNT=0x501 you get name collision. Because of backward compatibility you can use WinXP API on Win7. But what if this API not fully compatible or you want use WinXP specific API on WinXP and Win7 specific API on Win7? I think we need add definition of this macro in luarocks config. May be as extra_defines or extra_cflags variables. ------------------------------------------------------------------------------ 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