Please add wWinMain() to juice_Initialization.h

Compiling under MinGW-64 with UNICODE support (-municode linker flag) requires wWinMain as the entry point to the executable.

Both UNICODE and _UNICODE are defined in my project. 

I use the following workaround for now (juice_Initialization.h, from line 96) 

  #if defined (WINAPI) || defined (_WINDOWS_)
   #define JUCE_MAIN_FUNCTION       int __stdcall WinMain (HINSTANCE, HINSTANCE, const LPSTR, int)
  #elif defined (UNICODE)
   #define JUCE_MAIN_FUNCTION       int __stdcall wWinMain (void*, void*, const wchar_t*, int)
  #elif defined (_UNICODE)
   #define JUCE_MAIN_FUNCTION       int __stdcall WinMain (void*, void*, const wchar_t*, int)
   #define JUCE_MAIN_FUNCTION       int __stdcall WinMain (void*, void*, const char*, int)


I don't have a mingw-64 build to work with - could you suggest some #ifdefs that will only be present when doing a mingw-64 build? For example, a cleaner approach might be to leave the existing defines, but add

#if [some kind of mingw64 flag]
 #define WinMain wWinMain 


I would suggest something like this:

   #define JUCE_MAIN_FUNCTION       int __stdcall wWinMain (void*, void*, const wchar_t*, int)

JUCE_MINGW is already defined in juce_TargetPlatform.h (#ifdef __MINGW32__ , line 87)


Surely that'd be active for a 32-bit build too? I thought you meant that this was only needed for a 64-bit build?

And what about my suggestion to redefine WinMain instead? Seems like that'd be less repeated code.

Yes, this define is set to 1 when compiling under mingw-64 in 64-bit mode. I do build for both 32 and 64 archs at the same time. 

My build system has two separate toolchains for each arch:

  • GCC 4.8.1, Mingw-w64 ver 3.1.0,  Target: x86_64-w64-mingw32
  • GCC 4.8.1, Mingw-w64 ver 3.1.0,  Target: i686-w64-mingw32 

You're right, putting the define as you've suggested in the main file just before START_JUCE_APPLICATION solves the problem. So, no need to change the library code. Thank you for your help!