I’ve recently created a DLL project using the MinGW (4.8.1) compiler through the CodeBlocks IDE, and in the debugging output folder I have: my “.dll” (“AttribRdr.dll” in this case) file with an Export Definition File and finally a “.a” file (“libAttribRdr.a” in this case).
According to my knowledge, the programs built for Linux/Unix based operating systems use libraries in the “.a” format. My question is: can I use that “.a” file, generated by MinGW on my Windows system, on my Linux system without having to change the library’s code or to re-compile? Obiously I would have to change the code of the program using the “.a” library, but otherwise can I use that “.a” file as-is?
I’m asking this because I know MinGW aims to be a “cross-platform” C++ compiler and if I can use the generated “.a” file on Linux systems without having to re-compile it would reduce my workload drastically.
Advertisement
Answer
To use libraries (or executables) built on Windows in Linux environment you need to cross-compile your code. GCC is capable of cross compilation – so you can research the topic, there is plenty of information.