lua-users home
lua-l archive

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


On Fri, May 19, 2017 at 12:39 AM, Jonathan Goble <jcgoble3@gmail.com> wrote:
> On Fri, May 19, 2017 at 3:12 AM Russell Haley <russ.haley@gmail.com> wrote:
>>
>> Okay, I had some progress. I think. I've run out of time but I have
>> created two VS projects. One for  a dll and one for the lua.exe. The
>> DLL compiles but I am getting complaints from the exe project:
>>
>> Severity Code Description Project File Line Suppression State
>> Error LNK2019 unresolved external symbol lua_close referenced in
>> function main PUC-Lua N:\Code\lua-5.3.4\Visual Studio\PUC-Lua\lua.obj
>> 1
>> Severity Code Description Project File Line Suppression State
>> Error LNK2019 unresolved external symbol lua_gettop referenced in
>> function docall PUC-Lua N:\Code\lua-5.3.4\Visual
>> Studio\PUC-Lua\lua.obj 1
>>
>> and so forth. I don't have time to do a proper clean up so I stuffed a
>> zip file with everything here:
>>
>>
>> https://github.com/RussellHaley/PUC-Lua-Installer/blob/master/lua-5.3.4.zip
>>
>> Someone might be able to compile it in VS 2015 if you change the target
>> SDK?
>>
>> Either way, thanks for all the great help!
>>
>> Oh, and Mr. Laurie is right. This would have all worked if I just
>> added the libgcc_s_dw2-1.dll file to the installer with joedfs builds.
>> lolz. Thankfully I've saved that code...
>>
>> zzzz...
>> Russ
>
>
> Shot in the dark before I go to bed: your lua.exe project file only lists
> lua.h and lua.hpp as headers. You may need to manually add the other
> standard headers (luaconf.h, lualib.h, and lauxlib.h) to the project to get
> VS to recognize them.

(facepalm)

> (Also, lua.hpp is only needed if you're compiling as C++ rather than C, so
> you can delete it from the project.)

In my first attempt I did not have lua.hpp in the exe project. The
linker complained that there was no lua.lib file available as output
from the library project. "Mr. Google" said that the absence of a
*.lib output was due to the dll not exporting any interfaces. The
Microsoft literature indicated I either need to annotate the c files
or create a *.dep file.

My working assumption is this should all just work without modifying
the original source code so a little more digging turned up someone
using the "extern C" keyword (for something that looked kinda
related???), which I remembered seeing in the hpp. When I dropped
lua.hpp in the exe project, that's when I got to the errors in the
previous email. So, did I fix something and move forward or break
something else and move backwards? I'll know better tonight.


Russ