Ok guys,

Im writing a game programming library as DLLs. I would like to be able to call functions from the EXE in my DLL. Its only for simplification for the newbie programming that might use my DLL :). Have a function named "Blah" and the dll will use it just like it was its own.

Anyway.. I was thinking if I could some how get my DLL to call a virtual function by getting the proc address of a function in the EXE with GetProcAddress, it would work.

But I dont know exactly how to do that and if that is even the correct way.

Any help would be wonderful. This seems like a reverse plugin architecture doesnt it? hehe

Torch
Posted on 2001-12-23 11:47:58 by Torch
I looks twisted minded ... :)

After all the whole ideea of a DLL is to be called by EXE Applications ... this is the most simple and helpfull thing esp. for newbies....but if you nedd the reverse i recomend using CallBack's.

I this way the EXE will give you a "safe" procedure addres for you to call
Posted on 2001-12-23 12:17:09 by BogdanOntanu
The whole thing is this function "Blah" so to speak is called after the Windows message translation and dispatching.

The whole point Im trying to do is allow the programmer to call a function to have it set up a window and a message loop and message handling, and then they'd only have to write their program in the "Blah" function.

Its for a simple game library ;).

So.. how would I set up these callbacks to work right?
Posted on 2001-12-23 12:29:44 by Torch
Nothing? :(
Posted on 2001-12-24 15:44:19 by Torch
The simple user of this simple game DLL will have to call a setup function in your DLL first.

Guess what? one of the parameters will be the address of the CallBack.

He will provide that as "offset My_Game_Main"

Then, when the game redraw will start you (aka the DLL) will call this My_Game_Main inside the modifyed message loop (aka on PeekMessage)

After all it will run in the space on the EXE, so you only have to care about what registers EXE should preserve

PS
I moved the thread here
Posted on 2001-12-24 22:22:49 by BogdanOntanu
I hope this dosen't become the base for ANOTHER solititare.
Or mine sweeper....:)


Anunitu

I wish SOMEONE would do a decent RPG for windows, closest thing I have seen was castle of the winds, and that was a clone of ROGUE

Blink Blink Blink, I can see just fine, no no, don't turn off the monitor, OH, I see, it was off for the last 5 minutes
Posted on 2001-12-30 16:42:29 by Anunitu
Castle of the winds ROCKED - anybody got full version? :-P.

If you wanna call .exe function from .dll, callback is the only sane
way. Exports from .exe are *not* handled correctly, even if your
image has relocation information. On win2k it "sort of" works, on
9x it is *totally* b0rked (like everything else). Oh well, PlatformSDK
DOES say that you should only use this on exe images to get at
their resources...
Posted on 2001-12-30 22:52:43 by f0dder