in reply to hiding console

Just guessing - perhaps the problem will go away if you use this approach to hide the window:
BEGIN { Win32::SetChildShowWindow(0) if defined &Win32::SetChildShowWindow +; }
Then of course you shouldn't be using the --gui option of whatever compiler you are using.