|
----- Original Message -----
From: Luiz Henrique de Figueiredo Date: 4/8/2014 11:46 AM That version of lmathx calls luaL_register. The 5.2 version calls luaL_setfuncs. I do not see a version that combines them together in the same source file and separates the Lua 5.1 and 5.2 builds with one #ifdef.Anyway, the first portability fix would be to make the same code compile against Lua 5.1 and 5.2 like a lot of other modules: LUALIB_API int luaopen_mathx(lua_State *L) { #if LUA_VERSION_NUM <= 501 luaL_register(L,LUA_MATHLIBNAME,R); #else lua_getglobal(L,LUA_MATHLIBNAME); luaL_setfuncs(L,R,0); #endifHave you checked lmathx for 5.1? It does that already: http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/5.1/lmathx.tar.gz Grep does not find acosh() (or others) in Visual Studio 2010.For Visual Studio 2010 and 2012, the following warnings and errors are generated. I don't know what you would do to fix them.If these compilers support C99 math functions then there is probably a switch somewhere. Note how I've used #define _GNU_SOURCE 1 so that it works in Linux, which is probably not optimal but worked on the systems I tested. In Visual Studio 2012, despite being available in amp_math.h, lmathx.c has to be compiled as a C++ file: #if _MSC_VER == 1700 #include <amp_math.h> using namespace Concurrency::precise_math; #endif and weird warnings result: lmathx.c(31) : error C3930: 'Concurrency::precise_math::acosh' : no overloaded function has restriction specifiers that are compatible with the ambient context 'Lacosh' (one of many) So, I would say that lmathx.c can only build successfully under Visual Studio 2013. -Josh |