Question

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?

Était-ce utile?

La 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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top