Hi,
You need to first be compiling your static library against bionic libc
(the C library used by Android). Since Android runs on Linux, the
appropriate file extension for a static library will be ".a". Windows
static libraries (".lib") will not work.
There is an NDK macro $(BUILD_STATIC_LIBRARY), if you are new to this
then I suggest doing it this way. Here is an example of what your
Android.mk file should include:
#------------------------------------
# Android.mk
#------------------------------------
LOCAL_PATH := $(call mydir)
# First, build your static library.
include $(CLEAR_VARS)
LOCAL_MODULE := mylib-static
LOCAL_SRC_FILES := my_c_file.c
include $(BUILD_STATIC_LIBRARY)
# Next, build your shared library which includes the static library.
include $(CLEAR_VARS)
LOCAL_MODULE := mylib-shared
LOCAL_SRC_FILES := my_other_c_file.c
LOCAL_STATIC_LIBRARIES := libmylib-static
# Include this next line if you want to write to the system log from
your native code.
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
#-------------------------------
# EOF
#-------------------------------
If there is some compelling reason to build your static library
outside the NDK, I suppose to compile your static library against
Bionic libc by hand (or using a GNU Makefile) and then include this in
your app by building it into a shared library created by your
Android.mk file...
Read the NDK documentation (ANDROID-MK.txt explains the
*_STATIC_LIBRARIES macros) and check out the .mk scripts that are
actually being used when `ndk-build` is invoked.
Good luck!
- Charles
On Jul 29, 12:32 pm, Christian Linne <
christian.li...@googlemail.com>
wrote:
> You should note that using a windows-library (in general) will not work - it
> has to be rebuilt (.a - files are the equivalent to .libs, approximately).
>
> 2010/7/29 Pedro Lamarão <
pedro.lama...@gmail.com>
>
>
>
>
>
> > Ben wrote:
>
> > > LOCAL_LDLIBS := -lvbase_d.lib
>
> > Ben wrote:
>
> > > LOCAL_LDLIBS := -lvbase_d.lib
>
> > To include a static library in the link:
>
> > LOCAL_LDLIBS := /path/to/liblvbase.lib
>
> > --
> > P.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "android-ndk" group.
> > To post to this group, send email to
andro...@googlegroups.com.
> > To unsubscribe from this group, send email to
> >
android-ndk...@googlegroups.com<android-ndk%2Bunsubscribe@googlegr
oups.com>
> > .