|
On 28-Jan-07, at 4:28 PM, RJP Computing wrote:
On 1/28/07, Rici Lake <lua@ricilake.net> wrote:No, it's just an extension library; in the normal way, you can compileyour extension libraries as DLL's and simply use require() to load them(or you can preload them in your application if you're embedding Lua.)Are there any requirements for what compiler to use? Should I use VC or MinGW for Windows, if I get the binaries from http://luaforge.net? Does the compiler even matter?
I'm don't do Windows, so I don't know, but in theory it shouldn't matter which compiler you use, since all compilers (are supposed to) produce compatible DLLs, as I understand it.
Mark Edgar has done an (in my opinion) nice binding of setenv, spawn and some other system calls which works on both Windows and Un*x. See http://lua-users.org/wiki/ExtensionProposal for details.Wow that looks great!There are other bindings as well, or you can write your own -- it's very easy.Should I use the extension proposal as a model or is there an article/tutorial on writing an extension.
See the book Programming in Lua. The first edition is available on-line from the www.lua.org site, but it covers Lua 5.0 so you may well consider investing in a copy of the second edition which covers Lua 5.1, and is an excellent tutorial to all aspects of using Lua, including writing extensions.
However, if Mark's work satisfies your needs, you should probably just use it. No point reinventing the wheel.