android ndk - Need NDK Help: How to call a C++ function for shared library from another project that uses C++ -


i badly pulling hair not able figure out (even though searched lot on google). please help

situation:

  1. i have shared library. let's foo.so (code in c++)
  2. now in new project, want use shared library foo.so
  3. the new project code in c++. let's new project name foomate.
  4. i want call functions of functions or use classes of foo in foomate project cpp files without including actual source code of foo project (i.e. using foo.so file)

question: how can achieve this?

for example:

class foo { const char* givemeastring(); }  #include “foo.h”  const char* foo::givemeastring() { return “hello world!”; } 

now have compiled foo class in shared library called: foo.so

  1. now suppose writing project having cpp code. new cpp code wants reuse static library.

    // declaration

class foomate { void printdemo(); }

// implementation

#include “foomate.h” #include “foo.h”  void foomate::printdemo() { foo *testfoo = new foo(); cout<<givemeastring(); } 

how can achieve using foo.so file instead of using actual source code of foo.cpp

here android.mk file using

#adding foo.so file in project. local_path := $(call my-dir) include $(clear_vars)  local_module := foo-lib-module local_src_files := foo-lib.so local_export_c_includes := include include $(prebuilt_shared_library)  #new project , source code include $(clear_vars) local_module := foomate-module local_module_filename := foomate-lib  local_src_files := foomate.cpp local_c_includes := $(local_path)/classes/include  include $(build_shared_library) 


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -