variable to link system or external library during compilation


This variable contains the list of additional linker flags for use in building your shared library or executable. It enables you to use the -l prefix to pass the name of specific system libraries. For example, the following example tells the linker to generate a module that links to /system/lib/ at load time:


Using this, LOCAL_LDLIBS variable you can also specify the path to the library, for example, your library resides in path /home/myuser/android/mylibrary/lib/, the you can use below code to link this library,

LOCAL_LDLIBS := -L/home/myuser/android/mylibrary/lib/

Example might look like below,

 $ vim 
include $(CLEAR_VARS)
LOCAL_LDLIBS += -llog -lz
LOCAL_STATIC_LIBRARIES := libavformat libavcodec libpostproc libswscale libavutil libx264 libswresample
LOCAL_SRC_FILES := FFNewChunkedAudioVideoEncoder.c
LOCAL_CFLAGS := -march=armv7-a -mfloat-abi=softfp -mfpu=neon
LOCAL_MODULE := FFNewChunkedAudioVideoEncoder

Reference –

Reference :

Leave a Comment