同步操作将从 tboox/tbox 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
TBOX is a mutli-platform c library for unix, windows, mac, ios, android, etc.
It includes asio, stream, network, container, algorithm, object, memory, database, string, charset, math, libc, libm, utils and other library modules.
// configure
make config|f [PLAT=linux|mac|mingw|cygwin] [ARCH=x86|x64] [DEBUG=y|n] [SMALL=y|n] [DEMO=y|n] [PROF=y|n] [PREFIX=..] [BIN=] [PRE=] [SDK=]
make config|f [PLAT=ios] [ARCH=armv6|armv7|armv7s] [DEBUG=y|n] [SMALL=y|n] [DEMO=y|n] [PROF=y|n] [PREFIX=..] [BIN=] [PRE=] [SDK=5.0|5.1|6.0|..]
make config|f [PLAT=android] [ARCH=armv5te|armv6] [DEBUG=y|n] [SMALL=y|n] [DEMO=y|n] [PROF=y|n] [PREFIX=..] [BIN=] [PRE=] [NDK=..] [SDK=..]
// build
make [all]
make rebuild|r
make lipo ARCH1=armv6 ARCH2=armv7 DEBUG=[y|n] SDK=[5.0|5.1|6.0|..] // for ios
// update build
make update|u
// clean build
make clean|c
// install
make prefix|p
make install|i
// make info
make error|e
make output|o
make warning|w
// make document
make doc|d
// help
make help|h
// build for linux-x86 debug
cd ./tbox
[make f PLAT=linux ARCH=x86 DEBUG=y] => optional
make r
// build for linux-x64 release
cd ./tbox
[make f PLAT=linux ARCH=x64 DEBUG=n] => optional
make r
// build for linux and add cflags and ldflags
cd ./tbox
make f PLAT=linux CFLAG="-I." LDFLAG="-L. -lxxx"
make r
// build for mac
cd ./tbox
[make f PLAT=mac ARCH=x64] => optional
make r
// build for ios-armv7, using sdk7.1 framework
cd ./tbox
make f PLAT=ios ARCH=armv7 SDK=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
make r
// build for ios armv7 and arm64 universal version
cd ./tbox
make lipo ARCH1=armv7 ARCH2=arm64 SDK=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
// build for android-armv5te, need set the ndk and toolchains directory
cd ./tbox
make f PLAT=android ARCH=armv5te NDK=/home/xxxx/android-ndk-r9d BIN=/home/xxxx/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin
make r
// build for android-armv6, if ndk and toolchains have been setted
cd ./tbox
make f PLAT=android ARCH=armv6
make r
// build for windows using msvc
cd ./tbox
run ./msys.bat
[make f PLAT=msvc ARCH=x86] => optional
make r
// build for windows using mingw and need link libgcc.a from mingw
run msys
cd ./tbox
[make f PLAT=mingw ARCH=x86] => optional
make r
// build for windows using cygwin
run cygwin
cd ./tbox
[make f PLAT=cygwin ARCH=x86] => optional
make r
// build for windows and custom complier path and prefix and need link libgcc.a from mingw
run cygwin
cd ./tbox
make f PLAT=mingw ARCH=x86 BIN="/home/xxx/bin" PRE="i386-mingw32-"
make r
the installed prefix header and library directory after runing "make r":
inc: ./tbox/pre/inc/$(PLAT)/$(ARCH)/
lib: ./tbox/pre/lib/$(PLAT)/$(ARCH)/
for linux x64:
inc: ./tbox/pre/inc/linux/x64/tbox
lib[debug]: ./tbox/pre/lib/linux/x64/libtboxd.a
lib[release]: ./tbox/pre/lib/linux/x64/libtboxr.a
CFLAGS[debug]: -D__tb_debug__
CFLAGS[release]:
CFLAGS[optional]: -D__tb_prefix__="tag"
LDFLAGS[debug]: -L./tbox/pre/lib/linux/x64/ -ltboxd
LDFLAGS[release]: -L./tbox/pre/lib/linux/x64/ -ltboxr
for msvc x86:
inc: ./tbox/pre/inc/msvc/x64/tbox
lib[debug]: ./tbox/pre/lib/msvc/x64/tboxd.lib
lib[release]: ./tbox/pre/lib/msvc/x64/tboxr.lib
CFLAGS[debug]: -D__tb_debug__
CFLAGS[release]:
CFLAGS[optional]: -D__tb_prefix__="tag"
LDFLAGS[debug]: -LIBPATH:.\tbox\pre\lib/msvc\x86 tboxd.lib
LDFLAGS[release]: -LIBPATH:.\tbox\pre\lib/msvc\x86 tboxr.lib
#include "tbox/tbox.h"
int main(int argc, char** argv)
{
/* init tbox
*
* @param priv the platform private data
* pass JNIEnv* env for android
* pass tb_null for other platform
* @param data the memory data for the memory pool, uses the native memory if be tb_null
* @param size the memory size for the memory pool, uses the native memory if be zero
*
* for android: tb_init(jenv, tb_null, 0)
* for memory pool: tb_init(tb_null, malloc(10 * 1024 * 1024), 10 * 1024 * 1024);
*/
if (!tb_init(tb_null, tb_null, 0)) return 0;
// print info with tag
tb_trace_i("hello tbox");
// print info only for debug
tb_trace_d("hello tbox");
// print error info
tb_trace_e("hello tbox");
// init stream
tb_stream_ref_t stream = tb_stream_init_from_url("http://www.xxxx.com/index.html");
if (stream)
{
// save stream data to file
tb_transfer_done_to_url(stream, "/home/file/index.html", 0, tb_null, tb_null);
// exit stream
tb_stream_exit(stream);
}
// block: save http to file
tb_transfer_done_url("http://www.xxxx.com/index.html", "/home/file/index.html", 0, tb_null, tb_null);
// async: save http to file
tb_transfer_pool_done(tb_transfer_pool(), "http://www.xxxx.com/index0.html", "/home/file/index0.html", 0, 0, tb_null, tb_null);
tb_transfer_pool_done(tb_transfer_pool(), "http://www.xxxx.com/index1.html", "/home/file/index2.html", 0, 0, tb_null, tb_null);
tb_transfer_pool_done(tb_transfer_pool(), "http://www.xxxx.com/index2.html", "/home/file/index3.html", 0, 0, tb_null, tb_null);
tb_transfer_pool_done(tb_transfer_pool(), "http://www.xxxx.com/index3.html", "/home/file/index4.html", 0, 0, tb_null, tb_null);
// ...
// exit tbox
tb_exit();
return 0;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。