I want to create a DLL, what options do I have to set (I'm using Code::Blocks, but you can point directions for MSVC as well). In other words, how do I write the entry point of the code to be compiled as a DLL?
A DLL's entry point is DLLMain(), I mean it gets called by the loader.
But a main or WinMain will never be called in a DLL, nothing expects them to be there and they shouldn't be there. If the linker is complaining that one these is missing, the linker is misconfigured and is trying to link a program.
// ... more function definitions
// function1() definition
// !! function1() used to be main(), but I changed a lot of things so that it
// becomes a function on its own
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
// attach to process
// return FALSE to fail DLL load
// detach from process
// attach to thread
// detach from thread
return TRUE; // succesful