What am I allowed to do in "DllMain"?
Posted on 2004-03-30
Can anyone enlighten me about this code? Im trying to make a DLL who initializes some stuff in the DLLMain attaching process. I could of course just move the initializing code to start() or to a new function initialize() or something but I figured that the meaning of DllMain was just for cases like this? Or am I wrong? ... please Im goooing nuuuuts!
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
// ----- When moving this code segment to "start()", everything works good.. whats the difference?
SetSpeaker( 0, 90 );
SetSpeaker( 1, 270 );
audio = new RtAudio(&stream, 0, (int)CHANNELS, 0, 0, RtAudio::RTAUDIO_FLOAT64, SAMPLE_RATE, &buffersize, 4);
audio->setStreamCallback(stream, &RainSynth, NULL);
extern "C" __declspec(dllexport) void Start()
// ----- When moving the above code segment to this place instead, everything works good.. why?
extern "C" __declspec(dllexport) void Stop()