lua-users home
lua-l archive

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


Denis Lamarche wrote:
> > > Has anyone compiled a LUA library (static or dynamic) in mingw32??
> > >
> > I just did this last night.  No problems.
> >
> What command line did you use to compile and link lua.

make

> Did you use a makefile??

Yup.

> Did you create a .lib, .a, or .dll?

.a

> How did you compile your test program (or app using lua)??  Can you give me an example of what
you did to get it to work?

You can look at the distribution for two examples: 'lua' and 'luac'. Check out the makefile for
'lua', it is very simple.

If you create a file named 'test.c' in the root of the Lua distribution directory, with the
following contents:

  #include "lua.h"
  #include "lualib.h"
  int main() {
    lua_State* L = lua_open(0);
    if (L) {
      lua_baselibopen (L);
      lua_dostring(L, "print 'Hello, World'");
      lua_close(L);
    }
    return 0;
  }

You should be able to build it with the following command line:

  gcc -Iinclude -Llib  test.c -llua -llualib

Cheers,
Eric


__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1