Here is a trouble I'm having and struggling with it for some days.
- We have a software artifact which we distribute both as a DLL and a static library;
- One client wants to use the static library with a number of other static libraries to build this gigantic DLL (bussiness requirements: just one single DLL file);
- He can actually build and link the gigantic DLL but when he loads it somehow (using VB6 or Delphi or C#), it flashes a console window during load;
- The client doesn't like this console flashing (neither do I) and I already tried a number of solutions: adding
-Wl,--subsystem,windows
and -mwindows
to the linker line when generating the DLL (important info: the DLL is built using GCC toolchain on MSYS2), searching for windows APIs that could have the side-effect of displaying a console, trying to remove some dependencies for the same reason;
- If the client uses our DLL directly (with a number of other DLLs) everything works fines (no console flashing). Both our libs (DLL and static) are built from the very same codebase;
- I also tried to remove parts of the code and came with the conclusion that it is actually my own code that's making the console flasing. I just don't know where. The DLL is written in a mix of C and C++, uses templates and some windows APIs;
- As a last try, I searched for some lib that could be actually calling the
AllocConsole
API but found nothing;
- This lib is actually a higher level wrapper around a number of well-known libraries: zlib, libpng, cairo, freetype, etc. I wonder if any of these could be the culprit here but I also wonder why in the DLL build it does not show up.
Could someone, please, give me some directions?
Thank you!
I found out the problem. There is this tiny little piece of code that actually needs to enumerate Windows fonts. No problem, just use the system
function, enumerate fonts via Windows registry using the reg
cmd line utility, redirect to a txt file, process it and voila, fonts enumerated.
And just for the record, don't forget to put it into a separate thread otherwise it will show in the debugger in an easy way and help the poor guy that is mantaining the code (me, btw).
Thank you for all your help.