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:
extern "C" {
DLLIMPORT void _ReceiveCoreDataPtr__________ ( LPVOID pCore )
{
// Get Core Data Pointer here
g_pGlob = (GlobStruct*) pCore;
}
} // End extern "C"
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.