Mingw disable TLS ( thread local storage ) on Windows - windows

Hello i have a project which i converted to dll, compiled with the mingw-w64-i686-toolchain
Problem is when building exe or dll mingw creates 3 tls callbacks TlsCallback_0,TlsCallback_1,TlsCallback_2 and also some TLS data produced and embed in CRT section. This causes my dll to crash, similar project converted using visual studio works. Is there some switch or any solution to disabl tls generation by mingw compiler?

Related

Rust - How to remove the dependency on ucrtbase.dll?

When compiling my Rust app in Windows 10, it is linked against ucrtbase.dll; however, this dll does not exist on some editions of Windows Server 2008 R2 Datacenter, making my app impossible to execute.
I tried setting -Ctarget-feature=+crt-static as found here, but it did not do anything; ldd app.exe still shows this dll.
Is there a way of removing the dependency on this dll?
If your Rust app does not depend on C libraries that specifically require the MSVC toolchain, you can build it for the x86_64-pc-windows-gnu (or i686-pc-windows-gnu, to build for 32-bit CPUs) target instead. This target links to DLLs that are available in all Windows versions.
For more information about the different Windows ABIs, you can check out this documentation page.

mfc120.dll missing for an application built in VS2013

I have a VC++ based application developed in VS2010 which uses some of the win32 component. I ported the code in VS2013 and I built the code after removing all compilation error in Release Mode. Now when I am trying to run the exe in Computer where VS2013 is installed it is working fine where as it is giving an error of mfc120.dll is missing where only VS2010 is installed. I don't think after building the code in Release mode I should get an error of missing dll. I have not tried to run the exe where no Visual Studio is installed.
If you are using the DLL version of the MFC you also need to install the corresponding VS-2013 runtime DLLs vsredist_x86
Or you switch to a complete static build.
I have found out the solution for this problem. Basically the win32 code I was building was using the Configuration Properties->General-> 'Use MFC in a Shared DLL' which I changed to 'Use MFC in a Shared DLL'. All working fine there after

Qt Application Calling Dll from Fortran

Here's the problem I got for Qt Application(Qt4\Qt5) calling Dlls from Fortran(CVF\IVF).
Qt4+Dll(CVF)+WinXp
It works fine in my PC both in QtCreator and as solo.
not working in other's (xp or win7/8)
the error is "dll not loaded" ( .isLoaded() false message)
then my PC's dead, got new one and immigrated to Qt5 with IVF.
But still the problem:
Qt5+Dll(IVF with complier_platform win32)+Win8
It works fine in my PC both in QtCreator and as solo
not working in other's (xp or win7/8)
the error is "dll not loaded" ( .isLoaded() false message)
Well, after trying them from various PCs:
I suppose it's not the platform problem(32bit or 64)
I am sure the dll path is correct when calling
Qt calling codes are
if(stlDll.load()){
myfun fun1 = (myfun)stlDll.resolve("STLDLL");
if ( fun1 ){
fun1(fileName_For90);
}
}
else
QMessageBox::information(NULL, "File Missing",tr("dll not loaded, the Directory is ")+dllPath, QMessageBox::Ok);
the error is always "dll not loaded", however that's the very right dllPath where I can find the dll with eyeballs but the Qt Applicaiton can not.
Fortran dll compiling codes are :
!DEC$ ATTRIBUTES DLLEXPORT,ALIAS::stlDLL
Typically DLL's compiled with Intel Fortran are dynamically linked to the Intel Fortran (and underlying Microsoft C++) runtime DLL's. Are your Fortran DLL's compiled and linked that way?
If so, you need to have the Intel Fortran runtime DLL's (and the underlying Microsoft C++ runtime DLL's) installed on the target machine.
You can get installation packages for the Intel Fortran runtime DLL's from the Intel website in the same manner that you acquire downloads of the compiler (or see here). You can get installation packages for the Microsoft C++ runtime libraries by searching the Microsoft website (they are Visual Studio version and service pack specific). Alternatively, merge modules and installation exe's for the runtimes may have been installed on your machine as part of the Intel Fortran and Visual Studio installations.

Deploy mixed code Visual Studio application

I have a problem running my application on other machines.
I am developing with Visual Studio 2008 in a Win7 x64 machine.
The solution contains several C# projects (the main application is written in C#, all others are library projects) and two c++/CLI libraries. The C++ libraries are Win32 and all C# projects are set to x86 target processor. No third party libraries used. Framework used is v3.5.
The application builds and runs fine on my machine.
I copied the whole "bin\release" folder to a Win7 x86 machine and it ran fine, too.
But when I tried on a XP x86 system, it did not start. No error message, not even showing up shortly in the task manager. The XP system has all updates installed, all available .NET frameworks installed and all Visual Studio Runtimes installed.
I checked with DependencyWalker and the only missing dlls are "IEShim.dll" and "wer.dll" which are only for Vista or higher.
I tried another of my applications that's not using C++ libraries and they work fine. So I guess I am doing something wrong deploying the C++ dlls.
Registering the C++ dlls with "regsvr32" failed with a "DllEntryPoint" not found message. Registering with "regasm" was successful, but had no effect.
What is it that I am missing?
Well, seems like I was a bit hasty stating "no third party components".
Actually it was the SQL Server Compact who was missing its runtime.

How to build Google breakpad on Windows with Qt Creator (gcc/MinGW)?

Given: Application project written for Qt Creator (4.7.4, Win32 only, gcc/MinGW).
Needed: Plug in well-known Google breakpad library to gather verbose crash dumps from customers.
My current findings are as follows:
there is breakpad-qt project out there, about two years old. It contains subtree of upstream breakpad sources to be built with Qt Creator, so I've tried to produce working example by building it.
breakpad itself inherently depends on DbgHelp.h from Windows SDK, because of usage of Microsoft minidump format.
DbgHelp.h can be found in Windows SDK headers, but
further includes some headers from Visual Studio, which are reportedly could not be compiled by GCC/MinGW (incompatible language extensions by MSVS compiler, I suppose).
google breakpad includes MSVS solution files (produced by gyp), and is readily buildable by MSVS (I've succeeded with both 2008 and 2010 Express versions), producing some .libs to be linked with target application.
but the .lib files compiled above are not understood by MinGW ld, so could not be linked with Qt project. It is known incompatibility of library formats.
though, .lib files from MSVS 2008 (and not 2010) are understood by reimp tool from MinGW tools (latest available), which is intended to translate libraries from MSVS format to MinGW usable format. In my case the symbols are exported seemingly correctly, and some .obj files too, but recompiled library (with dlltool of MinGW) is still unlinkable by MinGW ld.
And all the fuss with .lib linkage is blocked with another problem: valid headers are required in Qt Project in order to compile client code, and these headers are exactly those from breakpad, including DbgHelp.h, see above!
Currently open alternatives I see:
Entirely switch the application from Qt/MinGW (Creator) to Qt/MSVS, which could allow direct linking of upstream breakpad. I think this is the core of success of little googleable use cases of Qt + breakpad at all.
Construct some some hybrid approach, where application is built as usual with Creator and later linked with breakpad by MSVS linker. But again, headers!
Tear off a minimal closure of what breakpad needs from Microsoft headers in order to compile with pure Qt Creator.
Any suggestions, existing experiences?
Sorry to disappoint you, but the QtBreakpad integration has not been developed for and tested with MinGW.

Resources