2019独角兽企业重金招聘Python工程师标准>>>

一   Android ndk  支持c ++标准库文档,阉割很多c++  stl特性

C++ support with the Android NDK

================================

The Android platform provides a very minimal C++ runtime support library

(/system/lib/libstdc++) and corresponding headers for it in the NDK.

I. C++ Exceptions support:

--------------------------

The NDK toolchain supports C++ exceptions, since NDK r5, however all C++

sources are compiled with -fno-exceptions support by default, for

compatibility reasons with previous releases.

To enable it, use the '-fexceptions' C++ compiler flag. This can be done

by adding the following to every module definition in your Android.mk:

LOCAL_CPPFLAGS += -fexceptions

More simply, add a single line to your Application.mk, the setting will

automatically apply to all your project's NDK modules:

APP_CPPFLAGS += -fexceptions

NOTE: The obsolete "arm-eabi-4.4.0" toolchain provided for backwards

compatibility with this NDK does not support exceptions!

II. RTTI support:

------------------

Similarly, the NDK toolchain supports C++ RTTI (RunTime Type Information)

since NDK r5, but all C++ sources are built with -fno-rtti by default for

compatibility reasons. To enable it, add the following to your module

declarations:

LOCAL_CPPFLAGS += -frtti

Or more simply to your Application.mk:

APP_CPPFLAGS += -frtti

NOTE: The obsolete "arm-eabi-4.4.0" toolchain provided for backwards

compatibility with this NDK does not support RTTI!

III. Selecting the C++ Standard Library Implementation:

-------------------------------------------------------

By default, the headers and libraries for the minimal C++ runtime system

library (/system/lib/libstdc++.so) are used when building C++ sources.

You can however select a different implementation by setting the variable

APP_STL to something else in your Application.mk, for example:

APP_STL := stlport_static

To select the static STLport implementation provided with this NDK.

Value APP_STL values are the following:

system              -> Use the default minimal C++ runtime library.

stlport_static      -> Use STLport built as a static library.

stlport_shared      -> Use STLport built as a shared library.

WARNING: IMPORTANT CAVEAT

AT THE MOMENT, OUR STLPORT IMPLEMENTATION DOES NOT SUPPORT EXCEPTIONS

AND RTTI. PLEASE BE SURE TO NOT USE -fexceptions OR -frtti IN ALL

MODULES THAT USE IT.

WARNING: END OF IMPORTANT CAVEAT

"stlport_shared" is preferred if you have several shared libraries in your

project that use the C++ STL, because it avoids duplication of functions

and more importantly of global variables (e.g. std::cout) in each one of

them, which can have surprising results.

On the other hand, you will have to load it explicitely when starting your

application, as in the following example:

static {

System.loadLibrary("stlport_shared");

System.loadLibrary("foo");

System.loadLibrary("bar");

}

Where both "libfoo.so" and "libbar.so" depend on "libstlport_shared.so".

Note that the shared library's name if "libstlport_shared.so" to avoid

naming conflicts with certain Android system images which include a

system-level libstlport.so (which happens to not be ABI-stable and

cannot be used from NDK-generated machine code).

"stlport_static" is preferred if you have only one shared library in your

project: only the STL functions and variables you actually need will be

linked to your machine code, reducing its code size, and you won't need

to load the dynamic stlport_shared at startup.

IV. STLport-specific issues:

----------------------------

This NDK provides prebuilt static and shared libraries for STLport,

but you can force it to be rebuilt from sources by defining the following

in your environment or your Application.mk before building:

STLPORT_FORCE_REBUILD := true

STLport is licensed under a BSD-style open-source license. See

sources/cxx-stl/stlport/README for more details about the library.

V. Future Plans:

----------------

- Make STLport compatible with C++ exceptions and RTTI

- Full GNU libstdc++ support

- uSTL support?

二 : 第三方 c++  stl  for  ndk  ;使ndk完全支持c++ 模板块特性

NDK r5 add a lot of useful features

but without C++ exceptions or RTTI,

I still prefer CrystaX r4 version for my code.

Any plan to improve NDK r5 ? Thanks

I would like to second that. While r5 does support C++ exceptions, they don't actually work on API level 3 (Android 1.5), while the crystax r4 version works there. So crystax r5 would make sense.

Yes, r5 version of crystax NDK will be released soon. It will contain many improvements such as wcharsupport and more smooth C++ support.

First (experimental) build with enabled wchar_t support is uploaded tohttp://www.crystax.net/data/android-ndk-r5-crystax.tar.bz2. This archive contains both Windows and Linux binaries so can be used on both platforms; Darwin binaries are not ready yet. I don't publish it on main page because it's not ready to release yet; however, many peoples could start use it and report issues.

New build uploaded with many bug fixes included:

http://www.crystax.net/data/android-ndk-r5-linux-x86-crystax-1.beta1.tar.bz2

http://www.crystax.net/data/android-ndk-r5-windows-crystax-1.beta1.zip

android ndk 编译选项,Android NDK 对于c++的支持(mk文件内编译选项)相关推荐

  1. Android编译脚本(.mk文件)解析

    摘要:本文将简单介绍Android编译系统并举例说明如何编写不同类型的mk文件以达到不同的目的.虽然.mk文件即将被.bp文件替代,但是在Android9之前的版本中.mk文件的使用频率依旧很高,同时 ...

  2. 深入浅出Android NDK之Android.mk常用C/C++编译选项

    目录 上一篇 深入浅出Android NDK之Android.mk基本语法 在之前的深入浅出Android NDK之Hello-Ndk一章我们已经学习了编译一个动态库.静态库.可执行文件所需要的最基本 ...

  3. linux ndk编译静态库,Android开发教程:NDK编译静态库失败

    Android---NDK编译静态库失败 Android.mk 相关编译文件: include $(CLEAR_VARS) LOCAL_MODULE    := libdvnca LOCAL_SRC_ ...

  4. Android:JNI 与 NDK到底是什么

    前言 在Android开发中,使用 NDK开发的需求正逐渐增大 但很多人却搞不懂 JNI 与 NDK 到底是怎么回事 今天,我将先介绍JNI 与 NDK & 之间的区别,手把手进行 NDK的使 ...

  5. NDK JNI Android Studio开发与调试DEMO(三)(生成 .so 文件)

    Android Studio NDK 开发与调试(生成 .so 文件) 温馨提示:如果你的 Android Studio 版本在 3.0以上 , 建议你用 cMake /ndk-build 的新姿势进 ...

  6. android ndk r8d,(Android) NDK

    從 Android NDK | Android Developers 下载 Android NDK (我在 Ubuntu 所以下载 android-ndk-r5c-linux-x86.tar.bz2) ...

  7. 【Android 逆向】Android 进程注入工具开发 ( Visual Studio 开发 Android NDK 应用 | Visual Studio 中 SDK 和 NDK 安装位置 )

    文章目录 一.Visual Studio 中安装 " 使用 C++ 的移动开发 " 开发库 二.Visual Studio 中安装的 Android SDK 和 NDK 位置 三. ...

  8. 【Android 逆向】Android 进程注入工具开发 ( 系统调用 | Android NDK 中的系统调用示例 )

    文章目录 一.系统调用 二.Android NDK 中的系统调用示例 一.系统调用 在 " 用户层 " , 运行的都是用户应用程序 ; 用户层 下面 是 驱动层 , 驱动层 下面是 ...

  9. 【Android NDK 开发】NDK 交叉编译 ( Ubuntu 中交叉编译动态库 | Android Studio 中配置使用第三方动态库 )

    文章目录 I . 动态库 与 静态库 II . 编译动态库 III. Android Studio 使用第三方动态库 IV . Android Studio 关键代码 V . 博客资源 I . 动态库 ...

最新文章

  1. 科学教师与实验教师工作计算机,计算机实验指导教师工作职责
  2. UnicodeDecodeError: ‘utf-8‘ codec can‘t decode bytes in position 708-709: invalid continuation byte
  3. Apache Kafka-初体验Kafka(01)-入门整体认识kafka
  4. C语言中用栈实现进制转换,利用栈实现进制转换问题
  5. Requirements of pair programming
  6. nutch源代码阅读心得
  7. ILI9341液晶LCD彩色显示原理
  8. java仿QQ2.0版(一直忘了更)
  9. WinHttp用法(WinHttp.WinHttpRequest.5.1)
  10. 宝塔面板windows建站教程_宝塔面板建站教程
  11. 汇智网node学习笔记
  12. python编程的线性/非线性规划问题求解
  13. 冰羚中间件 conceptual-guide.md翻译
  14. 训练题库CTF题库最近在论证一个问题,到底是先有鸡还是先有蛋 (Ijm,lo 3wsdr4 6tghu7)
  15. 题目:利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A表示,60-89分之间的用B表示,60分以下的用C表示。
  16. 淘宝的字体也改变了(今天)
  17. soul-网关实战(一)学习路线
  18. 视频教程-机器学习数学基础--概率论与数理统计视频教学-机器学习
  19. 有限元分析的基本知识
  20. 7-4 美女排名 (15分)

热门文章

  1. ajax post提交数据_JavaEE学习——为什么get请求方式比post请求方式效率高
  2. Hadoop(二)搭建Hadoop集群
  3. eclipse java 注释_Eclipse Java注释模板设置详解
  4. [Hands-on Lab (2) - 使用Helm部署OpenShift应用
  5. 微软正在开发基于 Rust 的安全编程语言
  6. Ubuntu 20.04 LTS 开发周期的重要任务:移除 Python 2
  7. 曾经的独角兽 Docker,如今资金紧张
  8. C# —— IEnumerable和状态机
  9. 云南省计算机专业技术,云南省2018年下半年全国计算机技术与软件专业技术资格(水平)考试顺利举行...
  10. java遍历日期_Java遍历起止日期中间的所有日期操作