Archived

This topic is now archived and is closed to further replies.

Discussion: Function exports from an exe

This topic is 5602 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I noticed that you can give an .exe exports, just as a DLL does. Can anyone think up a reason for this? I was thinking, if you had a game, and exported the apps main setup function, you could write another exe if you wanted that would set everything up differently (e.g. OpenGL instead of D3D), and then do a GetProcAddress() on the setup function of the original app, and call it. That way you have an app that uses OpenGL that plugs in alongside the D3D version. I know it''d be a lot easier ti stick things in DLLs to do it, but this is just another way. So, what do people think? Are there any interesting things you can do with this ''feature''? Steve Steve
DirectX Programmer
Soon to be the new Bill Gates

Share this post


Link to post
Share on other sites
I have never tried to export functions from an EXE but I doubt the compiler will let you, or if it is possible. DLLs can be loaded into any part of the process'' virtual memory. EXEs get put in the same spot in virtual memory, so I guess it would be impossible to have 2 exes loaded at once

Share this post


Link to post
Share on other sites
Actually, it is quite possible. Except for a single flag in the header, there is essentially no difference between a DLL and an EXE. They both use exactly the same PE File format.

Share this post


Link to post
Share on other sites
quote:
Original post by Evil Bill

So, what do people think? Are there any interesting things you can do with this ''feature''?




EXEs with exported functions are how out-of-process servers work in COM programming. This causes your server to run in a separate process from the calling program which results in separate memory spaces, etc. This can be useful when many different applications need to share the data in one server.

Share this post


Link to post
Share on other sites