1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vlib: add Android checks to build V on Android

This commit is contained in:
hazohelet 2019-09-17 00:23:11 +09:00 committed by Alexander Medvednikov
parent a45895a3af
commit 9158ba4640
2 changed files with 14 additions and 8 deletions

View File

@ -27,14 +27,17 @@ pub fn print_backtrace_skipping_top_frames(skipframes int) {
return
}
$if linux {
if C.backtrace_symbols_fd != 0 {
buffer := [100]byteptr
nr_ptrs := C.backtrace(*voidptr(buffer), 100)
C.backtrace_symbols_fd(&buffer[skipframes], nr_ptrs-skipframes, 1)
return
}else{
C.printf('backtrace_symbols_fd is missing, so printing backtraces is not available.\n')
C.printf('Some libc implementations like musl simply do not provide it.\n')
$if !android {
// backtrace is not available on Android.
if C.backtrace_symbols_fd != 0 {
buffer := [100]byteptr
nr_ptrs := C.backtrace(*voidptr(buffer), 100)
C.backtrace_symbols_fd(&buffer[skipframes], nr_ptrs-skipframes, 1)
return
}else{
C.printf('backtrace_symbols_fd is missing, so printing backtraces is not available.\n')
C.printf('Some libc implementations like musl simply do not provide it.\n')
}
}
}
println('print_backtrace_skipping_top_frames is not implemented on this platform for now...\n')

View File

@ -539,6 +539,9 @@ pub fn user_os() string {
$if msvc {
return 'windows'
}
$if android{
return 'android'
}
return 'unknown'
}