I have a configuration where I am developing a GUI application that makes use of a third party library that is built using mingw64. I want to capture the standard output from the third party library, but not having any luck. Some details follow:
The GUI is written in C# / .Net. There is an engine component that is written in C++, and built with Visual Studio 2017. That engine component accesses a third party library which is built with mingw64. That third party library consists of FORTRAN and C/C++ code. The output that I am trying to capture is written from the C/C++ side using fprintf(stdout,..) calls. I do all the things I need to do to allocate a console, and hook up the stdout handles, etc. Like is shown here: https://gist.github.com/kingseva/a918ec66079a9475f19642ec31276a21 This works fine for any output that is written from the engine code built in VS, but I don't get any output from the third party library built with mingw64. I have developed a simple representative test case and found a few things: * If I allocate the console from a DLL built with VS (which is my specific use case), I never get the standard output from code built with mingw64 * In this scenario I can test to see if stdout is initialized in the mingw64 code using _fileno; so like: "auto n = _fileno(stdout);". In this case it returns -2, indicating that it isn't initialized. * If I allocate the console from a DLL built with mingw64, I do get output from the mingw64 DLL. * In this case _fileno returns 3 A final note. It seems that the mingw64 dll is linking to msvcrt.dll, while the DLL built with VS is linking to MSVCP140.dll and VCRUNTIME140.dll. Any ideas for how I can get the output from the dll's built from mingw64 without allocating the console from that side? Thanks! _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
