[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  Lua
. . -> [Subject]  Compile me crazy

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Compile me crazy
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Thu 27 Dec 2007 05:27 AM (UTC)  quote  ]
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
[Go to top] top

Posted by ThomasWatts   USA  (66 posts)  [Biography] bio
Date Thu 27 Dec 2007 04:10 AM (UTC)  quote  ]
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.
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Wed 26 Dec 2007 02:34 AM (UTC)  quote  ]
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
[Go to top] top

Posted by ThomasWatts   USA  (66 posts)  [Biography] bio
Date Wed 26 Dec 2007 01:52 AM (UTC)  quote  ]

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
[Go to top] 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.


2,423 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]