Startup

xiaoxiao2021-03-06  40

Compilation LUA

After the source code, you need to compile Lua, Lua is written in ANSI C, so any platform that supports C compiler supports compiling Lua, usually, we compile it under the Windows platform.

First introduce the directory structure after lua decompression

. ./bin/ Executable file directory, usually compile generation LUA interpreter and compiler will be placed in this directory

../doc/ Document, include reference manual

../etc/ Other LUA tools and their code

../include/ Reference LUA needs to include the header file

../lib/ Compile generation lib files are usually put here

../src/ Source code, including lib, compiler, interpreter

../test/ test script

(The following is for Win32 platform and VC6.0 compiler) The first step: Compile Liblua Contains Core Lib and Standard LIB, detailed, for simple start, we put it in a lib, we need to build a static library Engineering, then add its source file to the project, including the following files Core Lib: lapi.c lcode.c ldebug.c ld c lMP.c LFUNC.C LGC.C LLEX.C LMEM.C LOBJECT.C LOPCODES .c lparser.c LSTATE.C LSTRING.CLTABLE.C LTESTS.C LTM.C Lundump.c Lvm.c LUNDUMP.C LVM.C LZIO.C

Standard lib: lauxlib.c lbaselib.c ldblib.c Liolib.c lmathlib.c ltablib.c lstrlib.c loadLib.c and set it to LIB

The Second Step: Compile Interpreter For compilation interprezer, we need to create a Win32 console program, then join file Lua.c, and link to the LIB file we created above, set the include path to ../include/ under, The output path is set to ../bin/

3rd Step: The steps of compiling the compiler compiler are basically the same, but we need to join its luac.c print.c lopcodes.c, and define Lua_opNames

OK, the environment we need is basically established.

转载请注明原文地址:https://www.9cbs.com/read-68765.html

New Post(0)