Anyone had any luck compiling LUA?

Started by
6 comments, last by Kylotan 22 years, 3 months ago
First I tried compiling the source into a lua.lib, which appeared to work. Then in another project I linked with this, #included "lua.h", and it complained of missing objects at link time (lua_open, lua_close, etc). I think it''s because I am compiling the lib wrongly. Any clues as to what I''m missing or doing wrongly? [ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]
Advertisement
Hi,

I could be VERY wrong on this, but I believe that when you compile a .lib file that there''s a seperate .dll compiled along with it, this is where I think I''m very wrong. But if this is the case - make sure that the DLL is in the same location as the program.

Eh - well I tried...

Hope it helps!

Eric

//----------------------------
In a world without boundaries -
who needs gates or windows ?
----------------------------\\
did you added your lua.lib to your libraries (path and all) ? you can also add the file to your project in VC++.

C++ name mangling comes to mind, but thats a problem only if you use LoadLibrary() to load a DLL

Yes, it's added to the library path, and no, there shouldn't need to be a DLL (as I want to link staticly, not dynamically). I might try adding it to the project to see what that does.

Update: I added it to the project and it made no difference. Still 3 "unresolved external symbol" errors, for lua_close, lua_dostring, and lua_open. I reckon the .lib file isn't 'working'. I changed the #define that modifies all the API calls:
from
#define LUA_API extern
to
#define LUA_API __declspec(dllimport)

in the hope that it might make a difference, but it doesn't seem to. Any clues on how I can check if the .LIB is somehow incomplete? I admit to being a newbie as far as making static libraries is concerned.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]

Edited by - Kylotan on January 19, 2002 10:29:27 PM

Edited by - Kylotan on January 19, 2002 10:30:43 PM
Just off the cuff, did you search through the LUA source to make sure the lua_open(), lua_close() and lua_dostring() functions were actually defined anywhere? For static libs, this is the most reasonable thing I can think of.

[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!
Oh, and you definitely don''t want to use declspec(dllimport)!

[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!
Yeah, the functions are declared, and are definitely getting compiled. I can''t be sure they''re going into the .LIB though, cos I know nothing about lib making. Having said that, the lib is over 300k in size, so something is going in

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]
It was a stupid error: I forgot to enclose #include "lua.h" in an ''extern "C"'' block, so it was looking for C++ symbol names when the library contained C symbol names. Duh. I guess it shows that I am not used to interfacing the two languages. Shame they don''t have an #ifdef __cplusplus bit inside the header already, though.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]

This topic is closed to new replies.

Advertisement