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 return
} }
$if linux { $if linux {
if C.backtrace_symbols_fd != 0 { $if !android {
buffer := [100]byteptr // backtrace is not available on Android.
nr_ptrs := C.backtrace(*voidptr(buffer), 100) if C.backtrace_symbols_fd != 0 {
C.backtrace_symbols_fd(&buffer[skipframes], nr_ptrs-skipframes, 1) buffer := [100]byteptr
return nr_ptrs := C.backtrace(*voidptr(buffer), 100)
}else{ C.backtrace_symbols_fd(&buffer[skipframes], nr_ptrs-skipframes, 1)
C.printf('backtrace_symbols_fd is missing, so printing backtraces is not available.\n') return
C.printf('Some libc implementations like musl simply do not provide it.\n') }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') 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 { $if msvc {
return 'windows' return 'windows'
} }
$if android{
return 'android'
}
return 'unknown' return 'unknown'
} }