Discussion: Function exports from an exe

Started by
2 comments, last by Evil Bill 21 years, 8 months ago
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
Member of the Unban Mindwipe Society (UMWS)
Advertisement
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
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.
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
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.

This topic is closed to new replies.

Advertisement