Are static c libraries created with one compiler compatible with another?
Asked Answered
A

2

8

In my case I have a library built with code sourcery gcc targeting arm cortex-m4. I am trying to then link that library into a project being compiled with IAR compiler.

Is it possible to do this or does the library have to be rebuilt with the new tools? What factors affect this?

Adornment answered 8/10, 2013 at 13:44 Comment(0)
S
8

Static library is bundle of several object files which are always compiler specific. So if you try to link a gcc based lib with IAR compiler, you will get error at compile time due to mismatch between object file formats to be linked.

You need to rebuild your library using IAR.

Substation answered 8/10, 2013 at 13:50 Comment(1)
@Brandon Yates please check the answer given by Lindydancer and let us know if it works.I do not have all the resources available to crosscheck else i would have done it at my end. Technic given by him is totally new for me so me too very much interested to know if it is possible ..Thanks in advance.Substation
F
3

The IAR compiler for ARM supports the AEABI format, which allows you to compile files with one compiler and link with another.

If you have built your library using GCC and have enabled AEABE, it should be possible to use the static library in a project build using the IAR tools.

Feme answered 17/10, 2013 at 13:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.