   WinMain inside DLL
  i want to create an abstraction over my engine to allow people to program with it without having to know about the OS underneath. what i do is the following. the engine library contains the entry point for whatever system it runs on. it then dispatches to an instance of a subclass of deApplication which has been created by the executable using 'static MyClass theApp;' ( hence similar to MFC or BeOS ).under linux everything works without problems. the executable has no main() but as the main is inside the linked library all works.now under windows things don't work. although i have the WinMain inside my dll and correctly exported i get linker errors about WinMain@16 missing.any ideas how i can pull it off to have the entry point inside the dll so the programmer does not have to worry about writing it?   
  I don't think it's possible. At least not without serious trickery (such as perhaps settings the entry point in all executables to somewhere in the DLL or equally outlandish). I could be wrong, in that case - please flame me someone. An alternative method of doing what you want is a method used by, for example, SDL. The windows version ships with an additional static library called SDL_main.lib (or SDL_main.a for MinGW users) that contains the initialization code of SDL, which in turn calls the user's own main.   ;  The default libraries (what I called a "stub" here) used by compilers on Windows are hard coded to call WinMain (for GUI subsystem programs) or main (for console subsystem programs). You could supply your own version of these libraries but it wouldn't necessarily simplify things for your users. It seems to me that a simpler and more straightforward approach would be to have your users call imported initialize, execute and finalize functions from within the main/WinMain function of their program.   ;  it's a bit sad because on linux i can pull off this trick without any troubles and this way the launcher really levitates above the system, which is a welcome abstraction. so far i simply made a dragengine_entrypoint static lib ( of roughly 6k ) that i linked into the windows version of the launcher. if there is really no way to do it like i can do it under linux i would have to fall back to providing your own init call. somehow this is not so bad anymore since i decoupled the launcher from the effective app ( you can run a game through my engine using a launcher without having to link against the library at all ).how does for example MFC do this? there you have also to subclass CApp ( i think it's called ) and the go for the big cake so the WinMain has to be hidden somewhere too.   ;  I don't know all the particulars of how MFC does it, but it's worth pointing out that MFC isn't portable and is really only supported by Microsoft's compiler system which suggests that MFC probably replaces the default libraries with customized ones. One of the results from this search, mfc+winmain, says that MFC defines WinMain internally.  ;  Do it with a static library. Not a DLL. This is how SDL does it, IIRC.   ;  yes. and SDL #defines "main" to "SDL_main"; something that confused the hell out of me for a while :)just make a static lib, it's not too much of a hassle for end users, especially when end users are developers anyway.   ;  making a static dll out of the engine is impossible. it is a requirement that the engine has to be a separate DLL that can be updated on it's own. so the aproach of turning all into a static lib is a no-go for me.   ;Quote:Original post by RPTDmaking a static dll out of the engine is impossible. it is a requirement that the engine has to be a separate DLL that can be updated on it's own. so the aproach of turning all into a static lib is a no-go for me.main can go in the static lib. The rest can go in a dll proper.   