Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split]The reason GCC doesn't work for us
#3
(22.08.2008, 08:45:57)DCoder Wrote: Put it simply, it's got to do with gcc producing a different binary layout of the classes involved, which means all virtual functions get directed to the wrong locations.

To go into more detail, the game and MSVC-compiled DLLs translate, for example, TechnoClass::GetType() to "call [edx + 84h]", but GCC translates it to "call [edx + A0h]" instead. For objects that were constructed inside GCC code, that breaks when you return control to the game, and on object pointers created by the game it breaks right off the bat. That different layout shifts the offsets for member variables as well, making their access also incompatible. I've googled for hours and I haven't seen any mention of a correction for this anywhere.
Thank you for the concise detailed reply.

If I understand the situation correctly then pd compiled a .dll using Visual C which crated a .lib Import Library, but GCC has no idea how to use such .lib files.

Then when you compiled the exact same code using GCC to produce you're own .dll the GCC created its own .a Import Library. However, there is no standard in C++ on how everything is arranged/ordered in a binary. The GCC and Visual C Import Libraries map things differently because the .dll files they create are physically different and incompatible.

This isn't unusual. Read the secion Linking Against DLLs. Your wxDev-C++ IDE probably included the nm and dlltool programs needed to create a correct .a Import Library (which will need to be updated every time a class is added or modified.) As the article states make sure the VisualC .dll has not had its symbols stripped.

http://www.cygwin.com/cygwin-ug-net/dll.html

Here is another URL on some importing caveats on spotting calling conventions, though you probably already know about this stuff.
http://www.cygwin.com/ml/cygwin/2007-06/msg00696.html

I hope this helps. Let me know if the problem is somehow worse than this.

EDIT:
If it is worse then read this for another work-a-round.
http://www.cygwin.com/ml/cygwin/1997-06/msg00352.html
Also
http://www.cygwin.com/faq/
Reply


Messages In This Thread
[split]The reason GCC doesn't work for us - by Guest - 22.08.2008, 03:03:19
RE: Showtime - by DCoder - 22.08.2008, 08:45:57
Did you google for import libraries gcc? - by MrNybbles - 22.08.2008, 13:19:29
RE: Showtime - by DCoder - 22.08.2008, 14:19:19
RE: Showtime - by MrNybbles - 22.08.2008, 20:56:27



Users browsing this thread: 1 Guest(s)