samyeyo / LuaRT

Open source Windows programming framework for Lua
https://www.luart.org
Other
285 stars 17 forks source link

MSVC support? #69

Closed gvanem closed 1 year ago

gvanem commented 1 year ago

The front-page README.md says:

All you need to build LuaRT from sources is a valid installation of the Mingw-w64 GCC compiler, feedback is welcome for other C compilers.

OK, I'll try. The major hurdle was these IMO lame gcc contructs: w = w ?: lua_self(L, lua_gettop(L), Widget);

Why not simply: w = w ? w : lua_self(L, lua_gettop(L), Widget);? What is so intuitive and compact with ?:?

And this in compression/Zip.c:

  size_t len = 0;
  char tmp[len+2];

could simply say:

  char tmp[2];

I have several patches sitting here if these above could be fixed first.

samyeyo commented 1 year ago

Hello Gisle,

You are completely right 👍

The LuaRT codebase needs a bit of a cleanup ! For the example provided, I can even not explain it ! Might have been at a time when i was coding half awake 🙈

And this in compression\Zip.c:

  size_t len = 0;
  char tmp[len+2];

For compatibility with the Visual C++ compiler, a few changes would be enough, such as the example you give with the ?: operator, a new Makefile or even a solution for Visual Studio.

I need help though as I prefer to focus on fixing bugs and implementing new features rather than using new compilers.

There aren't enough hours in a day...

samyeyo commented 1 year ago

Update :

I have an internal working version of LuaRT compiled using latest Microsoft Visual C++ 2022, for both x86 and x64 I'm doing tests to chase some residual bugs. If everything works fine, it will be available in next LuaRT release

samyeyo commented 1 year ago

MSVC compiler support will be available for next LuaRT release, and will become the default target C/C++ compiler