I would like to have a DLL with window creation and management code in a way that the developer could just add a named main.h header and load the DLL to be able to instance a window.
#include "dllheader.h"
void user_main();
main = user_main; // attach user main to the dll callback
int user_main() {
Window *w = new Window();
}
on the DLL side the code should look like
void (*main)() = NULL;
int WinMain(...) {
if(main)
main(); // call the user defined funcion
while(!done) {
if(messageWaiting()) {
processMessage();
}
}
}
Why? because I want to deploy a window wrapper and avoid to have the user writting the WinMain entry point. But a DLL project have a DLL main and a win32 project that uses a DLL complaim if linker doesnt find a winMain entry point.
Is there a know solution for this kind of arrange?