Archived

This topic is now archived and is closed to further replies.

Kylotan

Anyone had any luck compiling LUA?

Recommended Posts

Kylotan    9866
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 ]

Share this post


Link to post
Share on other sites
Destroyer    122
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 ?
----------------------------\\

Share this post


Link to post
Share on other sites
Kwizatz    1392
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

Share this post


Link to post
Share on other sites
Kylotan    9866
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

Share this post


Link to post
Share on other sites
Kylotan    9866
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 ]

Share this post


Link to post
Share on other sites
Kylotan    9866
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 ]

Share this post


Link to post
Share on other sites