4 ms·
I'm not sure what the author expected when trying to link code that mixes uses of libstdc++ and libc++: there are not ABI compatible in any way. If you need ABI
by eklitzke 6y ago
I'm not sure what the author expected when trying to link code that mixes uses of libstdc++ and libc++: there are not ABI compatible in any way. If you need ABI compatibility between different compilers you must write C.
- beached_whale 6y agoThis isn't even compilers. clang is perfectly happy using other peoples std library implementations(well libstdc++ and MS STL's that I know of so far). I think it is more apt to say that you do not mix libraries with the same names here, or in this case don't mix std library implementations.
- josefx 6y agoI am not sure it is about mixing implementations, just that it crashes with one and not the other. One implementation runs the destructor and then sets the pointer to null -> when code invoked by the destructor accesses the pointer everything still works. The other implementation sets the pointer to null and then runs the destructor -> when code invoked by the destructor accesses the pointer it gets a null.
- ogoffart 6y agoFrom what I understand, this is not about mixing uses of different libraries. This is about a program that works fine with libstdc++, but crashes with libc++ because of a different behavior between the two: the order in which the destructor is called and the unique_ptr set to 0.
- hallarempt 6y agoI'm not sure how you could come to that conclusion? The problem is that the same code compiled on two different platforms with two different compilers and two different stdlib implementations crashes on one of those, and not on the other.
- formerly_proven 6y agoI'm not sure where you read the author linked libstdc++ and libc++ into the same application? The post notes a crash caused by these two implementations behaving slightly differently, which has nothing to do with ABI compatibility.