Why does a DLL compiled in MinGW crash? - dll

I have compiled one DLL in Cygwin using g++ 4.7. It works fine. But when I compile same code in MinGW and try to use a DLL. It crashes the program with access denied (CX00000005) error and shows libstdc++-6.dll as problem DLL.
Any help is appreciated.
Thanks in advance.

You are most likely missing a MinGW dll or have a cygwin dll in PATH when you run your application. Be sure to copy the correct dll's to the same directory as your exe.

Related

wxWidgets with visual studio 2015

I finish installing wxWidgets and build accordingly it give no problem.
I started a new project and adding the path to library and include and build this project it gives no problem, it works very well.
But When I run it give the error as wxbase31ud_vc_x64_custom.dll missing but actually this dll is there in the library folder.
what to do?
Help me to resolve this problem.
In order to load, a DLL must be in the application load path. It is not sufficient for it to be in the same directory as the import library. The safest thing to do is to place the DLL files in the same location as your executable. My personal preference is to statically link wxWidgets.

Missing libiconv-2.dll error when compiling on Notepad ++

I recently started using Notepad++ for programming. Now i get an error reporting that the libiconv-2.dll is missing. This happens when ever I try to compile using MinGW (which i just installed).
I have checked and the DLL is in the bin folder of MinGW. Any suggestions?

import DLL compiled in C++ in windows in MOno

I have a dll file that has been created and compiled with C++ under Windows and I unfortunately don't have the source code for it.
This dll file is working well with a .NET program compiled with visual studio.
I want to know if this is possible to import this dll file with mono, and execute it under a UNIX environment.
This dll file is sending some Smartcard APDU instructions.
Most probably no. Binaries are platform specific.
You can always try to disassemble it on Windows and try to compile the disassembled code on unix, however I think it's not worth it.

How to create Cygwin compatible library files from native Windows .dll and/or .lib files

I have downloaded both a .dll and a .lib file compatible for 32-bit Windows from libspotify. The project I am working on requires me to use other libraries that does not work on Windows, but compile and work using Cygwin. I therefore need a way to get the .dll and/or .lib file "converted" into a compatible Cygwin format. Is that possible?
The .dll file does not contain symbols, so the suggested method described in the bottom of the Cygwin doc did not work.
The other libraries that I have, generated the following files:
/usr/local/lib/{libname.la, libname.dll.a and sometimes libname.a}
/usr/local/bin/cyglibname.dll
Where libname is the name of the library correctly compiled and installed. How do I get these files from the native 32-bit Windows .dll and .lib files?
Update:
I tried to include the full path to the .dll file instead of using -l and -L as I am used to linking libraries, and I got the following message:
/usr/bin/ld: i386 architecture of input file `/usr/local/test/libspotify.dll' is
incompatible with i386:x86-64 output
It seems like the problem is the 32-bit vs 64-bit. Anyone know how to fix that?
Another update:
It worked by adding -m32 to CFLAGS and LDFLAGS. I now got a different error that I believe is irrelevant for the original question.
It seems like the problem is the 32-bit vs 64-bit. Anyone know how to fix that?
Yes; use 32 bit Cygwin for a project that depends on third party DLL's only available in 32 bit form. Do not use 64 bit Cygwin.
Cygwin and Cygwin-64 can be installed side by side, by the way. (And it's possible to share the same home folder between them, so you don't have to duplicate your .bashrc and whatnot.)
This is not a Cygwin problem. If you build a 64 bit executable with, say, Microsoft Visual Studio, it also will not load the 32 bit libspotify DLL.

Statically link to the dll files

I have already built a project, and run it in VS2010.
But if I want to run the .exe on other computers which does not
install Visual Studio, it will need .dll files (such as msvcrt.dll and
msvcp60.dll in WINDOWS\SYSTEM32, and some other dlls in the
development package). I didn't use MFC in this project. How to static
link all these dlls into the .exe file in Visual C++ so that I don't
have to copy all the dlls to the other machines?
BTW: I don't want to make install package either
Thanks
Siba
You can set your project to statically link the CRT, by using the /MT flag for the runtime library. Or, you could keep the /MD setting, and install the vcredist package along with your executable (you can get it from here, and also from one of your VS2010 installation folders). To get an idea of each options pros and cons, read this.
Oh, and a similar question has been asked before...