Source

BWToolkit+Cocotron / dllmain.m

//
//  dllmain.m
//  BWToolkit
//
//  Created by Christian Beer on 07.12.10.
//  Copyright 2010 Christian Beer. All rights reserved.
//

/** For Cocotron: 
 
 Frameworks and OBJCRegisterDLL on Windows
 
 ** Warning, this will be automatic in the future so don't customize the code if you don't have to.
 
 If you are compiling frameworks for Windows, you will need this code somewhere in it. I recommend creating a file
 dllmain.m and adding it to the Windows target only. This only applies to frameworks which are you linking the .exe 
 against, bundles don't need it.
 
 */

#import <windows.h>

__declspec(dllimport) int OBJCRegisterDLL(HINSTANCE handle);

int APIENTRY DllMain(HINSTANCE handle,DWORD reason,LPVOID _reserved) {
    
    if(reason==DLL_PROCESS_ATTACH)
        return OBJCRegisterDLL(handle);
    
    return TRUE;
}

#ifndef __APPLE__
void BWToolkitFrameworkLoad() {
    // intentionally does nothing
}
#endif