Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
267 views
in Technique[技术] by (71.8m points)

Can libraries built across multiple Android ndk versions work together?

I am working on an Android C++ project that requires me to build a new shared library and make a call into this library from existing code. Existing code uses a version of ndk that is quite old. I am thinking of using the latest version of ndk to build my shared library. My thought is, as long as the API and the ABI match, the integration should work fine.

Wondering if you see any issues with this approach.

Both, existing code and the new code, use stl. I am thinking I will simply link my code with static stl libraries to avoid any runtime conflicts. Do you think this would work? Regards.

question from:https://stackoverflow.com/questions/66049902/can-libraries-built-across-multiple-android-ndk-versions-work-together

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I observed only an issue when diferent native parts (prebuilts libraries and project libraries) were used different STL linkage. Prebuilts libraries were compiled by using static STL library but the project libraries used shared STL library and therefore sometimes code worked strangely (in my case it was an issue with using std::fstream and std::locale::facet due to global variables of template classes were instatiated twice).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...