Lua lua parser and compiler dynamic library

Dynamic library compiled lua

Create a new empty project in vs2017, the project name luadll.

Right project configuration options "All Configuration", the election platform, "all platforms."

conventional:

Output directory: $ (SolutionDir) .. \ bin \ $ (Platform) \ $ (Configuration) \

Seized directory: $ (SolutionDir) .. \ bintemp \ $ (Platform) \ $ (ProjectName) \ $ (Configuration) \

The default value of the project, the selected configuration type "dynamic libraries (.dll)"

 

 

I will download the source code and good lua this project in the same directory, luasrc all lua source.

 

 

Right Project -> Add -> Existing Item, will lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c lobject.c under luasrc directory lopcodes.c lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c lmathlib.c loslib. c lstrlib.c ltablib.c lutf8lib.c loadlib.c linit.c the c file, the entire election, introduced over.

 

 Right Project Properties, C / C ++ preprocessor preprocessor definitions add LUA_BUILD_AS_DLL

 

 

Then click Generate.

In the output directory, to give the following two documents.

 

 

Lua create a new empty project.

Right project configuration options "All Configuration", the election platform, "all platforms."

conventional:

Output directory: $ (SolutionDir) .. \ bin \ $ (Platform) \ $ (Configuration) \

Seized directory: $ (SolutionDir) .. \ bintemp \ $ (Platform) \ $ (ProjectName) \ $ (Configuration) \

 

 

Right Project -> Add -> Existing Item, select the lua.c, added to the lua project.

 

 

Right project, click Linker -> General -> Additional Library Directories.

$(SolutionDir)..\bin\$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories)

Click Linker -> Input -> Additional Dependencies: luadll.lib (lua source compiler's got a dynamic library, lib file after generation.)

 

 

 

 Click Generate

 

 In lua.exe same directory, create a file test1.lua

for i=1, 4 do

    print (i .. "cabbage insects love")

end

Execute the command line

 

Guess you like

Origin www.cnblogs.com/xuqiulin/p/11874977.html