lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


----- Original Message -----
From: Luiz Henrique de Figueiredo
Date: 4/8/2014 10:07 AM
[mathx] can be quite painful to build it, particularly
if your C compiler happens not to be gcc. In fact, I have not heard
of anyone getting it to work on (surprise, surprise) Visual C++.
I'd be very interested in what needs to be done to make mathx more portable.

<sigh> I get tired of the non-stop Visual C++ bashing. Can we please stop it? Visual C++ isn't going away.

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);
#endif

Outside of that, it compiles without issue on Visual Studio 2013.

For Visual Studio 2010 and 2012, the following warnings and errors are generated. I don't know what you would do to fix them.

lmathx.c(21) : warning C4013: 'acosh' undefined; assuming extern returning int lmathx.c(27) : warning C4013: 'asinh' undefined; assuming extern returning int lmathx.c(33) : warning C4013: 'atanh' undefined; assuming extern returning int lmathx.c(39) : warning C4013: 'cbrt' undefined; assuming extern returning int lmathx.c(45) : warning C4013: 'copysign' undefined; assuming extern returning int
lmathx.c(51) : warning C4013: 'erf' undefined; assuming extern returning int
lmathx.c(57) : warning C4013: 'erfc' undefined; assuming extern returning int lmathx.c(63) : warning C4013: 'exp2' undefined; assuming extern returning int lmathx.c(69) : warning C4013: 'expm1' undefined; assuming extern returning int lmathx.c(75) : warning C4013: 'fdim' undefined; assuming extern returning int
lmathx.c(81) : warning C4013: 'fma' undefined; assuming extern returning int
lmathx.c(89) : warning C4013: 'fmax' undefined; assuming extern returning int lmathx.c(98) : warning C4013: 'fmin' undefined; assuming extern returning int lmathx.c(105) : warning C4013: 'fpclassify' undefined; assuming extern returning int
lmathx.c(107) : error C2065: 'FP_INFINITE' : undeclared identifier
lmathx.c(107) : error C2051: case expression not constant
lmathx.c(108) : error C2065: 'FP_NAN' : undeclared identifier
lmathx.c(108) : error C2051: case expression not constant
lmathx.c(109) : error C2065: 'FP_NORMAL' : undeclared identifier
lmathx.c(109) : error C2051: case expression not constant
lmathx.c(110) : error C2065: 'FP_SUBNORMAL' : undeclared identifier
lmathx.c(110) : error C2051: case expression not constant
lmathx.c(111) : error C2065: 'FP_ZERO' : undeclared identifier
lmathx.c(111) : error C2051: case expression not constant
lmathx.c(124) : warning C4013: 'isfinite' undefined; assuming extern returning int lmathx.c(130) : warning C4013: 'isinf' undefined; assuming extern returning int lmathx.c(136) : warning C4013: 'isnan' undefined; assuming extern returning int lmathx.c(142) : warning C4013: 'isnormal' undefined; assuming extern returning int lmathx.c(148) : warning C4013: 'lgamma' undefined; assuming extern returning int lmathx.c(154) : warning C4013: 'log1p' undefined; assuming extern returning int lmathx.c(160) : warning C4013: 'log2' undefined; assuming extern returning int lmathx.c(166) : warning C4013: 'logb' undefined; assuming extern returning int lmathx.c(172) : warning C4013: 'nearbyint' undefined; assuming extern returning int lmathx.c(178) : warning C4013: 'nextafter' undefined; assuming extern returning int lmathx.c(184) : warning C4013: 'remainder' undefined; assuming extern returning int lmathx.c(190) : warning C4013: 'rint' undefined; assuming extern returning int lmathx.c(196) : warning C4013: 'round' undefined; assuming extern returning int lmathx.c(202) : warning C4013: 'scalbn' undefined; assuming extern returning int lmathx.c(208) : warning C4013: 'signbit' undefined; assuming extern returning int lmathx.c(214) : warning C4013: 'tgamma' undefined; assuming extern returning int lmathx.c(220) : warning C4013: 'trunc' undefined; assuming extern returning int
lmathx.c(270) : error C2065: 'INFINITY' : undeclared identifier
lmathx.c(272) : error C2065: 'NAN' : undeclared identifier

Josh