Precompiled library for windows
Hi, today i spent 6 hours to compile cjson in windows 11, so is any compiled package anywhere? because "luarocks make" not working right out of box lua_cjson.obj : error LNK2019. cjson.dll : fatal error LNK1120 i understand its all can be solved but, but it cant take to much time. So if author just wants non C/C++ people suffered so its good, i understand author, and i will pass this lib. And if author want help to users, so good windows compile manual or precompiled file will be veyr fine aid, thanks fo feading.
PS; I undertand that linux is cool and i prefer linux for development but sometime windows platform cant be avoided....
It is not hard to build on Windows, just some variables are not initialize to NULL that cause the build error.
lua-build.bat
set LUA=lua-5.4.7
set LUA_CJSON=lua-cjson-2.1.0
set "MSBUILD_PATH=Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe"
set "MSBUILD=%HOMEDRIVE%\%MSBUILD_PATH%"
:LUA
7z x %LUA%.tar.gz
7z x %LUA%.tar
:CJSON
if exist lua-cjson goto :BUILD
7z x %LUA_CJSON%.zip
ren %LUA_CJSON% lua-cjson
copy /y vsbuild\patch\lua-cjson\dtoa.c lua-cjson\dtoa.c
:BUILD
cd vsbuild
"%MSBUILD%" lua.sln /p:Configuration=Release /p:Platform=x64
"%MSBUILD%" lua.sln /p:Configuration=Debug /p:Platform=x64
"%MSBUILD%" lua.sln /p:Configuration=Release /p:Platform=Win32
"%MSBUILD%" lua.sln /p:Configuration=Debug /p:Platform=Win32
diff patch\lua-cjson\dtoa.c lua-cjson\dtoa.c
dtoa.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dtoa.c b/dtoa.c
index 520926c..62fce2f 100644
--- a/dtoa.c
+++ b/dtoa.c
@@ -2488,7 +2488,7 @@ fpconv_strtod
U aadj2, adj, rv, rv0;
ULong y, z;
BCinfo bc;
- Bigint *bb, *bb1, *bd, *bd0, *bs, *delta;
+ Bigint *bb = NULL, *bb1 = NULL, *bd = NULL, *bd0 = NULL, *bs = NULL, *delta = NULL;
#ifdef Avoid_Underflow
ULong Lsb, Lsb1;
#endif
@@ -3695,7 +3695,7 @@ dtoa
int denorm;
ULong x;
#endif
- Bigint *b, *b1, *delta, *mlo, *mhi, *S;
+ Bigint *b = NULL, *b1 = NULL, *delta = NULL, *mlo = NULL, *mhi = NULL, *S = NULL;
U d2, eps, u;
double ds;
char *s, *s0;