2

I have two projects. The output of first one is libtest.so file. Using this shared object file in the 2nd project, i want to generate final android executable, AndroidExe.

I generated libtest.so and its Android.mk is given below

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_CFLAGS := -g
LOCAL_ARM_MODE := arm
LOCAL_MODULE :=test
LOCAL_SRC_FILES := test.c 
export LD_LIBRARY_PATH=/data/local/tmp

include $(BUILD_SHARED_LIBRARY)

Here the problem i am facing is that, i don't know how to link this .so file in my final executable project. In this final project, i am using one of the function (sum(a,b)) defined in the .so lib.While do build, showing error undefined reference to 'sum'.Its Android.mk file is given below:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_CFLAGS := -g
LOCAL_ARM_MODE := arm
LOCAL_MODULE :=AndroidExe
LOCAL_SHARED_LIBRARIES := libtest.so
LOCAL_SRC_FILES := AndroidExe.c 

include $(BUILD_EXECUTABLE)
RHS
  • 21
  • 6

1 Answers1

2

just check ndk documentation and try some of the samples.

Praveen Sharma
  • 4,326
  • 5
  • 25
  • 45
  • Sorryy...i could not find any sample under ndk directory which explains creating executable . All samples are wriiten for creating libraries. – RHS Jan 10 '14 at 09:28
  • My question is how i can call functions defined in an .so file using executable. – RHS Jan 10 '14 at 09:40