[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Compiling LPeg on Windows
- From: mitchell <mforal.news@...>
- Date: Mon, 21 May 2007 12:17:58 -0400
That's what I do in Visual Studio. Make a dll project, edit out all
the kruft like resources and junky headers amonth other project
settings that MS puts in there for you. Then, add the 3 main Lua
headers to your project as well as lua51.dll and you should be set.
And don't forget to add luaopen_lpeg to the .def file.
VC 2005 is a bit different then, and for the sake of my sanity, I just
did a regular makefile project:
CWARNS = -Wall
LUADIR = -I../lua51/include/
COPT = -O2 -DNDEBUG
CFLAGS = $(CWARNS) $(LUADIR)
CC = cl
LD = link
LIBS = KERNEL32.lib lua5.1.lib
del /q lpeg.dll lpeg.obj lpeg.lib lpeg.exp
$(CC) $(CFLAGS) -c -olpeg.obj lpeg.c
$(LD) $(LDFLAGS) -DEF:lpeg.def -DLL -OUT:lpeg.dll lpeg.obj $(LIBS)
I've never really had experience writing makefiles, if theres a shorter,
more terse way, please point it out.
On 5/18/07, Roberto Ierusalimschy <email@example.com> wrote:
> How can I compile LPeg on Windows? I have Visual C++ Express 2005.
You must compile lpeg.c as a dll, exporting only luaopen_lpeg.
I am not sure about the details, but I guess you should create
a "dll project" with this single file, and edit it to add a
__declspec(dllexport) in the definition of luaopen_lpeg.
Somehow you must also provide to the project a file with Lua
declarations (simply add lua51.lib to the project??).
I hope someone in the list can fill the details...