I created a very simple C dll and I'm trying to load it using Lua interactive mode
When I use require
I get:
error loading module 'LuaExperiment' from file 'C:\Lua\5.2.4\LuaExperiment.dll' The specified procedure could not be found
When I use package.loadlib
I get
multiple Lua VMs detected
Bellow is the contents of my Lua installation folder (LuaExperiment is my project):
I did the following to create the folder above: Opened a Developer Command Prompt for VS2015 as an Administrator and entered the following commands:
> vcvars32
> cl /MD /O2 /c /DLUA_BUILD_AS_DLL *.c
> ren lua.obj lua.o
> ren luac.obj luac.o
> link /DLL /IMPLIB:lua5.2.4.lib /OUT:lua5.2.4.dll *.obj
> link /OUT:lua.exe lua.o lua5.2.4.lib
> lib /OUT:lua5.2.4-static.lib *.obj
> link /OUT:luac.exe luac.o lua5.2.4-static.lib
These are the changes I made to Project Properties:
Added C:\Lua\5.2.4;
to VC++ Directories->Include Directories
Changed C\C++->Advanced->Compile As
to Compile as C Code (/TC)
Added C:\Lua\5.2.4\*.lib;
to Linker->Additional Dependencies
Here are the .h and .c files: