Question

I have a third party static library that was built on AIX with gcc. When I try to link to that library using the xlC AIX compiler I get all sorts of unresolved symbols. I believe it is due to the differences in name mangling. If I get the manged names out of the library with the nm command is there anything fundamentally wrong with building the binary with the xlC compiler provided it can find the symbols it is looking for? What troubles am I asking for?

Was it helpful?

Solution

This will very likely not work; see the C++ Faq Lite question about this.

C++ is a lot more complicated than C, and there's a lot of additional things that might not be compatible.

For a few examples, is the exception handling compatible? Are data objects laid out in the same way (in C, the order is as listed, but in C++ it can vary with access specifiers)? Do the vtables work the same? How is dynamic_cast handled?

The difference in name mangling is stopping you from linking, but there are many other differences that can bite you.

You're probably better off using the version of gcc they did. That's what I had to do in a similar project once.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top