0

I have seen similar questions but I'm not sure if it matches my question.

I have been provided a .so file, whose functions I want to call in my own C++ code. How do I link my C++ file to the .so file. I know how to directly link .so files to Java code via this.

Is there some way I can do this? I'm thinking something like linking via CMake. Is there some better way?

Please let me know if there's a question like if it's asked before. Thanks in Advance.

kiner_shah
  • 3,939
  • 7
  • 23
  • 37
  • How is this question related to Android? On which platform is your C++ code? What is that .so file - what architecture does it support - is it for x86 or ARM? – kiner_shah Nov 23 '21 at 07:18
  • 1
    You need to link your c++ interface library (the one that contains all the jni stuff) with the provided .so file. `target_link_libraries` is indeed how you do that in Cmake. Don't forget to ship both .so files! – Botje Nov 23 '21 at 09:05
  • @kiner_shah I am using this with NDK – Ieshaan Saxena Nov 24 '21 at 08:04

0 Answers0