lua-users home
lua-l archive

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


> Message: 2
> Date: Fri, 27 Sep 2013 08:42:55 +0000
> From: Thijs Schreijer <thijs@thijsschreijer.nl>
> Subject: RE: Lua Distributions and Package Management
> 
> > I'm curious to know what the Windows compiler usage/breakdown is. My
> > sense from this list is that many use mingw et al. I don't and I
> > imagine that most people that are developing *for* Windows use VS.
> 
> Myself, I develop using VS. Once it does what I want, I fix it to work
> with MinGW to get rid of the MSVCxxx issues while using LuaRocks
> builtin mode as a 'make' equivalent. Next step is making it run on a
> linux box, still relying on LuaRocks for building.

I know I started this hare running (again) but just for balance, let me say
it is actually pretty easy to compile Lua and most well-written C libraries
in Visual Studio on Windows or XCode on MAC OS (I'm just starting on the
latter, but have met with easy success so far). On VS you need separate
projects for the Lua DLL, the Lua Interpreter and each library - use a DLL C
template for everything except the interpreter for which a command-line C
EXE template. Just dump the sources into the correct source folder, build
the Lua DLL first, establish a dependency of the resultant library stub and
build the other projects. Define the symbols LUA_BUILD_AS_DLL and LUA_LIB
for third party libraries and just the former for the Lua DLL. In XCode,
basically the same except you do not need to build a Lua library - it is all
in the executable. I'm sure there is some similar IDE on Unix, at the moment
I just type what Dirk Laurie told me to (cc -shared libname.c -o libname.so)
and it seems to work (mostly).

As for make files, declarative or whatever, what the hell is wrong with
procedural? Building *is* a procedure after all! Just use Lua (with a
suitable toolkit library), do not make us learn something else!

The Lua source code is brilliantly written and genuinely portable without
editing - using an Eclypse based IDE I even (quite easily) got it compiled
and running on a ARM microcontroller (before discovering that there was not
enough RAM to do anything useful!). Sadly third party libraries aren't
always so straightforward (in many cases there are good reasons for that).
My plea to library authors: learn from the Lua code base, pull out one of
the built-in libraries and use it as a template for your code.
If you run into a problem, look through the Lua code base - the Lua guys
probably faced and solved the same problem at some stage and you can bank on
their solution being portable.