Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / DEV-C++ and the dreaded GlobStruct

Author
Message
qwerty823
19
Years of Service
User Offline
Joined: 17th Jan 2006
Location:
Posted: 8th Apr 2006 02:35
I've been playing with TPCs using DEV-C++, and all was fine until I needed to get access to the GlobStruct. When I defined my ReceiveCoreDataPtr function, I realized it wasnt being called. It was then that I noticed that the C++ name mangling was not the same, and it wasnt finding the exported function.

So, I was off to find a solution, and I did, although not the best, but it seems to work, so I thought I'd share. I create my function like so:


This builds the DLL, with a bunch of underscores in the name, instead of the real mangled name. The extern "C" is important, since we dont want this name to be mangled. Once the DLL is built, I can then "edit" it, and "rename" the function from _ReceiveCoreDataPtr__________ to ?ReceiveCoreDataPtr@@YAXPAX@Z so that it will have the name expected by DBPro.

I'm doing this by hand after the dll is built, but my next step is to make a small executable that will do this for me. Once that is done, I can add a small step to the end of my makefile to make this happen automatically.

Unless someone has a better idea, Ill stick with this for now. If anyone knows of some other magic to get the GlobStruct pointer, I'd love to hear about it. If this thread generates some interest, maybe ill do a writeup and possibly even make the program I write to do the fixup available.
the_winch
22
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 8th Apr 2006 02:49 Edited at: 8th Apr 2006 02:51
I believe you can call the ?GetGlobPtr@@YAKXZ function in DBProCore.dll as well.

edit:
There is an example in this thread. (IanM's first post)
http://forum.thegamecreators.com/?m=forum_view&t=55014&b=20

By way of demonstration, he emitted a batlike squeak that was indeed bothersome.
qwerty823
19
Years of Service
User Offline
Joined: 17th Jan 2006
Location:
Posted: 8th Apr 2006 03:06 Edited at: 8th Apr 2006 03:12
Thanks for that info. Didnt know that function existed. Ill give that a try.

Edit: Worked like a champ. Thanks again.

Login to post a reply

Server time is: 2025-05-19 07:38:54
Your offset time is: 2025-05-19 07:38:54