的Android NDK找不到ATOF功能 [英] Android ndk can't find atof function
问题描述
我想使用一个开源的C库在我的Android项目。该库使用 ATOF()
功能。我知道, ATOF()
是在标准C库(stdlib.h中)中定义的函数。因此,应该在标准C库在Android NDK(仿生库)。
但是,当我尝试加载包含调用该函数库,我收到运行时错误:
java.lang.UnsatisfiedLinkError中:无法加载库:reloc_library [1285] 86找不到ATOF....
我使用NDK在Android开发的初学者,所以也许我只是错过了什么样的标志,编译器指令等。
我的 android.mk
文件是:
LOCAL_PATH:= $(叫我-DIR)
包括$(CLEAR_VARS)
LOCAL_ALLOW_UNDEFINED_SYMBOLS:=真
LS_CPP = $(SUBST $(1)/ ,, $(通配符$(1)/ $(2)/ *。c))的
LOCAL_MODULE:=力霸
LOCAL_SHARED_LIBRARIES:= \
libgmodule-2.0 \
libgobject-2.0 \
libgthread-2.0 \
libglib-2.0
LOCAL_SRC_FILES:= sourceFile.c
包括$(BUILD_SHARED_LIBRARY
静态__inline__双ATOF(为const char * NPTR)
{
返程(关于strtod(NPTR,NULL));
}
ATOF
在换句话说不是一个库函数,它是一个内联函数调用的strtod
。
如果你需要通过加载一个库调用,只需使用的strtod
代替。
I am trying to use an open source C library in my Android project. This library uses the atof()
function. I know that atof()
is a function defined in the standard C library (stdlib.h). Therefore, it should be implemented in standard C library on the Android NDK (bionic library).
But, when I try to load a library that contains calls to this function, I receive a runtime error:
java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1285]: 86 cannot locate 'atof'....
I am a beginner in Android development using the NDK, so maybe I just missed something like flags, compiler directives, etc.
My android.mk
file is:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
LS_CPP=$(subst $(1)/,,$(wildcard $(1)/$(2)/*.c))
LOCAL_MODULE := libA
LOCAL_SHARED_LIBRARIES := \
libgmodule-2.0 \
libgobject-2.0 \
libgthread-2.0 \
libglib-2.0
LOCAL_SRC_FILES:= sourceFile.c
include $(BUILD_SHARED_LIBRARY
From stdlib.h in the Android source;
static __inline__ double atof(const char *nptr)
{
return (strtod(nptr, NULL));
}
atof
is in other words not a library function, it's an inline function that calls strtod
.
If you need to call through loading a library, just use strtod
instead.
这篇关于的Android NDK找不到ATOF功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!