Replies: 2 comments 2 replies
-
I tested the latest canary/CI build of r27 and the CMake checks phase works but the compilation fails to include android {
ndkVersion = "27.0.11248060"
ndkPath = "/path/to/android-ndk-r27-canary"
} #include <jni.h>
#include <string>
#include <sstream>
#include <source_location>
#include <stacktrace>
int nested_func(int c)
{
std::cout << std::stacktrace::current() << '\n';
return c + 1;
}
int func(int b)
{
return nested_func(b + 1);
}
std::string log(const std::string_view message,
const std::source_location location =
std::source_location::current())
{
std::ostringstream ss;
ss << "file: "
<< location.file_name() << '('
<< location.line() << ':'
<< location.column() << ") `"
<< location.function_name() << "`: "
<< message << '\n';
return ss.str();
}
template<typename T>
std::string fun(T x)
{
return log(x);
}
extern "C" JNIEXPORT jstring
JNICALL
Java_com_myscript_nebo_myapplication_MainActivity_stringFromJNI(
JNIEnv *env,
jobject /* this */) {
std::string hello = "Hello from C++";
hello += "\n";
hello += log("Hello world!");
hello += "\n";
hello += fun("Hello C++20!");
hello += "\n";
return env->NewStringUTF(hello.c_str());
} Notice that the include of |
Beta Was this translation helpful? Give feedback.
2 replies
-
It is now possible to track Clangs Standard conformance: https://clang.llvm.org/cxx_status.html Android Clang and Apple Clang don't still match LLVM releases exactly. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd like to evaluate
std::stacktrace
on Android but this requires c++23 which isn't available with latest NDK r26.In Android Studio new C++ project wizard, we can only pick c++17 at most.
When changing manually in Gradle, it appears c++20 is supported and
std::source_location
usage compiles.Is this official (I guess so, but it's not mentioned anywhere AFAIK).
Doing the same with c++23 fails when CMake checks compiler support.
Any plan or roadmap to support c++23?
Linked to that, I saw #1714 and #925
Would that mean a minimum version of the Android runtime required for that or would it work thanks to the compiler features only?
Didn't see anything about that in Roadmap.md
Beta Was this translation helpful? Give feedback.
All reactions