lilzz
lilzz

Reputation: 5413

Android NDK and its library

Inside the Android NDK, if want to include the Android SDK lib of

   #include <android/log.h>

I would do the following inside the Android.mk build file

    LOCAL_LDLIBS := -llog

The log=log.h

So, if I want to include the Android SDK

      #include <android/bitmap.h>

I would do

        LOCAL_LDLIBS:=-lbitmap?

that's one question. ANother is if need more includes then I have list one by one like above for log.h and bitmap.h?

Upvotes: 1

Views: 702

Answers (1)

Chris Stratton
Chris Stratton

Reputation: 40407

No, there is not a 1:1 correspondence between header files and libraries, though in a few cases they happen to coincide.

Playing with grep seems to show that functions from <android/bitmap.h> are in libjnigraphics.so, which would imply

-ljnigraphics

For a complete and formal reference, view the file "STABLE-APIS.HTML" in the docs/ directory of your NDK installation, where you will find this:

The 'jnigraphics' Library:
--------------------------

This is a tiny library that exposes a stable, C-based, interface that allows
native code to reliably access the pixel buffers of Java bitmap objects.

To use it, include the <android/bitmap.h> header in your source code, and
and link to the jnigraphics library as in:

  LOCAL_LDLIBS += -ljnigraphics

Upvotes: 3

Related Questions