Android 原生开发
跳转到导航
跳转到搜索
Bionic
basename
函数可能不会(像 glibc 那样)改变输入字符串。
系统属性
查询和修改系统 DNS。代码以 LuaJIT 示例。[1][2]
-- header: sys/system_properties.h etc
ffi = require('ffi')
ffi.cdef[[
int __system_property_get(const char *name, char *value);
int __system_property_set(const char *key, const char *value);
]]
buf = ffi.new('char[92]') -- 92 is PROP_VALUE_MAX
ffi.C.__system_property_get('net.dns1', buf) -- returns value length
ffi.string(buf)
ffi.C.__system_property_set('net.dns1', '112.124.20.192')
工具链
创建工具链:
/opt/android-ndk/build/tools/make_standalone_toolchain.py --arch arm64 --api 28 --install-dir android-toolchain-28