Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ Lua
➜ Compile me crazy
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| ThomasWatts
USA (66 posts) Bio
|
Date
| Wed 26 Dec 2007 01:52 AM (UTC) Amended on Wed 26 Dec 2007 01:53 AM (UTC) by ThomasWatts
|
Message
| My problem is the following:
I compile Lua with g++ and I must compile SMAUG with g++ as well.
If I compile Lua with gcc, then I have to use gcc with SMAUG.
Zlib on the other hand can only compile with gcc, but links fine either way.
If I try to compile Lua with g++ and SMAUG with gcc I get undefined reference errors to lua functions, ie. lua_pushnil.
Does anyone else have this problem? Is this just a very minor concern and I'm being obsessive?
Also, Merry Christmas those in the USA | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Wed 26 Dec 2007 02:34 AM (UTC) |
Message
| When you include the Lua .h files you have to put extern around them like this:
extern "C" {
#include "lua.h"
// and any other Lua files
}
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| ThomasWatts
USA (66 posts) Bio
|
Date
| Reply #2 on Thu 27 Dec 2007 04:10 AM (UTC) |
Message
| Just to reply to this, I was originally perplexed as to why C++ code could call external(dll) C code, but not the other way around.
C++ mangles function names to allow for templates which C code does not understand.
I just decided to compile both in C++ which works fine. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Thu 27 Dec 2007 05:27 AM (UTC) |
Message
| Yes, exactly, and when you use ' extern "c" ' it tells the linker that this particular DLL does not have mangled names. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
14,041 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top