Is it possible to embed the main() function into a DLL?
I have searched the forums here, but none of 28 threads seem to have a relevant information. Note that I'm not talking about DllMain.
For those who are interested why I want to do something like this. I have written my own service stuff (plain C/WIN32 API), and now I want to put it in a library. The concept works as a static library (I can create a static lib, link the application against this lib, implement in the app the functions required by the service lib, the service lib calls for example an application defined servicestopping() function when someone wants to stop the server, ..., this is all ok). Now I want to transform this static service library to a service dll. Is this possible?
I don't need all the service related baggage as an example. If this is possible, could someone point me to an example where a main() function resides in a dll, and this main() acts as the main function of another project. Thanks
Thanks to both of you. Igor, altough Arjay hit the mark I must admit that your post is insightful
In this case 1) is there a way for my DLL to invoke a function implemented in the user application, other than passing the pointer to the function to MyMain() and, 2) if I decide to use a static lib is there a way to preserve the function namespace in my static library other than declaring all my functions static (like static void cool_function(int arg) ) ?