Search code examples
c++gccobject-files

Archive files x32 or x64?


In C++, when you archive object files into a .a file, does it matter the platform?

For example I'm on an x64 platform compiling with x64 compiler, I compile a bunch of CPP files into .o files. Using AR.exe, I archive them into a .a file and distribute that.

Will the .a file be x32, x64 or interchangeable? OR does it depend on the program using the .a file?


Solution

  • Presuming that "compiling with x64 compiler" means that it generates 64-bit code, whether or not it is a 64-bit executable itself, then your .a files will be 64-bit code. They are generated from your .o files, which are 64-bit binaries generated by your compiler. The .a couldn't be anything more or different than the .o files are which constitute it.