[skill][msgpack] 初试msgpack库以及基本使用
It's like JSON.
but fast and small.
http://msgpack.org/index.html
源码:
https://github.com/msgpack/msgpack-c
扩展阅读:
用到了Cmake ,大概是一个用来生成makefile的系统 :https://cmake.org/overview/
https://zh.wikibooks.org/zh/CMake_%E5%85%A5%E9%96%80/%E8%BC%B8%E5%87%BA%E4%BD%8D%E7%BD%AE%E8%88%87%E5%AE%89%E8%A3%9D
release:
cpp-2.1.2
呃! 搞了半天也不知道如何用git 把一个tag down下来。有点糗。。。。
直接download zip文件: file:///home/tong/Downloads/msgpack-c-cpp-2.1.2.zip
对应的文档:
https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_overview
编译:
[root@okk msgpack-c-cpp-2.1.]# cmake .
[root@okk msgpack-c-cpp-2.1.]# make
哇塞,竟然有进度百分比,我也要这样的makefile。0.0 -.- ~O.O~
[root@okk msgpack-c-cpp-2.1.]# cmake .
-- The C compiler identification is GNU 4.4.
-- The CXX compiler identification is GNU 4.4.
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.3")
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Performing Test MSGPACK_ENABLE_GCC_CXX_ATOMIC
-- Performing Test MSGPACK_ENABLE_GCC_CXX_ATOMIC - Failed
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Configuring done
-- Generating done
-- Build files have been written to: /root/src/thirdparty/github/msgpack-c-cpp-2.1.
[root@okk msgpack-c-cpp-2.1.]# make
Scanning dependencies of target msgpackc
[ %] Building C object CMakeFiles/msgpackc.dir/src/objectc.c.o
[ %] Building C object CMakeFiles/msgpackc.dir/src/unpack.c.o
[ %] Building C object CMakeFiles/msgpackc.dir/src/version.c.o
[ %] Building C object CMakeFiles/msgpackc.dir/src/vrefbuffer.c.o
[ %] Building C object CMakeFiles/msgpackc.dir/src/zone.c.o
Linking C shared library libmsgpackc.so
[ %] Built target msgpackc
Scanning dependencies of target msgpackc-static
[ %] Building C object CMakeFiles/msgpackc-static.dir/src/objectc.c.o
[ %] Building C object CMakeFiles/msgpackc-static.dir/src/unpack.c.o
[ %] Building C object CMakeFiles/msgpackc-static.dir/src/version.c.o
[ %] Building C object CMakeFiles/msgpackc-static.dir/src/vrefbuffer.c.o
[ %] Building C object CMakeFiles/msgpackc-static.dir/src/zone.c.o
Linking C static library libmsgpackc.a
[ %] Built target msgpackc-static
Scanning dependencies of target lib_buffer_unpack
[ %] Building C object example/c/CMakeFiles/lib_buffer_unpack.dir/lib_buffer_unpack.c.o
Linking C executable lib_buffer_unpack
[ %] Built target lib_buffer_unpack
Scanning dependencies of target simple_c
[ %] Building C object example/c/CMakeFiles/simple_c.dir/simple_c.c.o
Linking C executable simple_c
[ %] Built target simple_c
Scanning dependencies of target speed_test_uint32_array
[ %] Building C object example/c/CMakeFiles/speed_test_uint32_array.dir/speed_test_uint32_array.c.o
Linking C executable speed_test_uint32_array
[ %] Built target speed_test_uint32_array
Scanning dependencies of target speed_test_uint64_array
[ %] Building C object example/c/CMakeFiles/speed_test_uint64_array.dir/speed_test_uint64_array.c.o
Linking C executable speed_test_uint64_array
[ %] Built target speed_test_uint64_array
Scanning dependencies of target user_buffer_unpack
[ %] Building C object example/c/CMakeFiles/user_buffer_unpack.dir/user_buffer_unpack.c.o
Linking C executable user_buffer_unpack
[ %] Built target user_buffer_unpack
Scanning dependencies of target class_intrusive
[ %] Building CXX object example/cpp03/CMakeFiles/class_intrusive.dir/class_intrusive.cpp.o
Linking CXX executable class_intrusive
[ %] Built target class_intrusive
Scanning dependencies of target class_intrusive_map
[ %] Building CXX object example/cpp03/CMakeFiles/class_intrusive_map.dir/class_intrusive_map.cpp.o
Linking CXX executable class_intrusive_map
[ %] Built target class_intrusive_map
Scanning dependencies of target class_non_intrusive
[ %] Building CXX object example/cpp03/CMakeFiles/class_non_intrusive.dir/class_non_intrusive.cpp.o
Linking CXX executable class_non_intrusive
[ %] Built target class_non_intrusive
Scanning dependencies of target custom
[ %] Building CXX object example/cpp03/CMakeFiles/custom.dir/custom.cpp.o
Linking CXX executable custom
[ %] Built target custom
Scanning dependencies of target enum
[ %] Building CXX object example/cpp03/CMakeFiles/enum.dir/enum.cpp.o
Linking CXX executable enum
[ %] Built target enum
Scanning dependencies of target map_based_versionup
[ %] Building CXX object example/cpp03/CMakeFiles/map_based_versionup.dir/map_based_versionup.cpp.o
Linking CXX executable map_based_versionup
[ %] Built target map_based_versionup
Scanning dependencies of target protocol_new
[ %] Building CXX object example/cpp03/CMakeFiles/protocol_new.dir/protocol_new.cpp.o
Linking CXX executable protocol_new
[ %] Built target protocol_new
Scanning dependencies of target reuse_zone
[ %] Building CXX object example/cpp03/CMakeFiles/reuse_zone.dir/reuse_zone.cpp.o
Linking CXX executable reuse_zone
[ %] Built target reuse_zone
Scanning dependencies of target simple
[ %] Building CXX object example/cpp03/CMakeFiles/simple.dir/simple.cpp.o
Linking CXX executable simple
[ %] Built target simple
Scanning dependencies of target stream
[%] Building CXX object example/cpp03/CMakeFiles/stream.dir/stream.cpp.o
Linking CXX executable stream
[%] Built target stream
[root@okk msgpack-c-cpp-2.1.]#
ditails
Cmake 指定按照目录
[root@okk msgpack-c-cpp-2.1.]# cmake CMakeLists.txt -DCMAKE_INSTALL_PREFIX=/root/output/
API: http://c.msgpack.org/c/index.html
api的 packing 用法:
https://github.com/msgpack/msgpack-c/wiki/v2_0_c_overview#packing
api的 unpack 用法:
https://github.com/msgpack/msgpack-c/wiki/v2_0_c_overview#unpack
举个栗子:
cmake -DCMAKE_INSTALL_PREFIX=$INS_PATH
make
make install
[skill][msgpack] 初试msgpack库以及基本使用的更多相关文章
- 【SimpleMsgPack.NET】发布一个msgpack协议C#版本的解析开源库
这两年一直都关注这IOCP在网络通信这方面的应用,当然数据的传递是经常需要的.今年接触了MsgPack格式,发现他用来做传输时数据打包真是太爽了.因为他可以直接打包二进制数据,不需要任何的转换.有人会 ...
- 二进制协议gob及msgpack介绍
本文主要介绍二进制协议gob及msgpack的基本使用. 最近在写一个gin框架的session服务时遇到了一个问题,Go语言中的json包在序列化空接口存放的数字类型(整型.浮点型等)都序列化成fl ...
- 重点关注之自定义序列化方式(Protobuf和Msgpack)
除了默认的JSON和XML序列化器外,如果想使用其它格式的(比如二进制)序列化器,也是可以的.比如著名的Protobuf和Msgpack,它们都是二进制的序列化器,特点是速度快,体积小.使用方法如下. ...
- 序列化库MessagePack应用(C++)
介绍 MessagePack(简称msgpack)是一个小巧而高效的序列化/反序列化库,支持多种开发语言.官方网站:http://msgpack.org/ . 下面是官方的一个简介: It's lik ...
- python之celery的使用(一)
前段时间需要使用rabbitmq做写缓存,一直使用pika+rabbitmq的组合,pika这个模块虽然可以很直观地操作rabbitmq,但是官方给的例子太简单,对其底层原理了解又不是很深,遇到很多坑 ...
- Pyhon进阶9---类的继承
类的继承 基本概念 定义 格式如下 继承中的访问控制 class Animal: __CNOUT = 0 HEIGHT = 0 def __init__(self,age,weight,height) ...
- ZMQ和MessagePack的简单使用(转)
近段日子在做一个比较复杂的项目,其中用到了开源软件ZMQ和MessagePack.ZMQ对底层网络通信进行了封装,是一个消息处理队列库, 使用起来非常方便.MessagePack是一个基于二进制的对象 ...
- python之celery使用详解一
前段时间需要使用rabbitmq做写缓存,一直使用pika+rabbitmq的组合,pika这个模块虽然可以很直观地操作rabbitmq,但是官方给的例子太简单,对其底层原理了解又不是很深,遇到很多坑 ...
- django-redis 中文文档
Andrey Antukh, niwi@niwi.be 4.7.0 翻译: RaPoSpectre 1. 介绍 django-redis 基于 BSD 许可, 是一个使 Django 支持 Redis ...
随机推荐
- [docker]macvlan实现双vlan互通
关于vlan的冷知识 vlan范围:0~4095 0,4095 保留 仅限系统使用 用户不能查看和使用这些VLAN 1 正常 Cisco默认VLAN 用户能够使用该VLAN,但不能删除它 2-1001 ...
- linux每日命令(6):rm命令
rm是常用的命令,该命令的功能为删除一个目录中的一个或多个文件或目录,它也可以将某个目录及其下的所有文件及子目录均删除.对于链接文件,只是删除了链接,原有文件均保持不变. rm是一个危险的命令,使用的 ...
- Python 读取csv的某行
站长用Python写了一个可以提取csv任一列的代码,欢迎使用.Github链接 csv是Comma-Separated Values的缩写,是用文本文件形式储存的表格数据,比如如下的表格: 就可以存 ...
- 【GMT43智能液晶模块】例程三:CAN通信实验
实验原理: STM32F429自带有CAN通信接口,本例程通过CAN1与芯片SN65HVD230相连 实现CAN通信,通过回环测试以验证CAN通信功能. 实验现象: 源代码下载链接: 链接:http: ...
- Go Revel - i18n(国际化)
##Messages `Messages`信息是对内容提供翻译的外部文本片段.revel提供了组织每一种语言文本片段的message文件.自动区域查找.基于cookie覆盖的消息嵌套和参数. 术语表: ...
- Android集成Google地图详细步骤记录
先贴下Google官方的地图demo地址:https://github.com/googlemaps/android-samples 那么接下来第一步,申请Google的API key. 使用谷歌账号 ...
- java-信息安全(十二)-数字签名【Java证书体系实现】
概述 信息安全基本概念 数字证书 数字证书就是互联网通讯中标志通讯各方身份信息的一串数字,提供了一种在Internet上验证通信实体身份的方式,数字证书不是数字身份证,而是身份认证机构盖在数字身份证上 ...
- 【中间件安全】Apache 安全加固规范
1. 适用情况 适用于使用Apahce进行部署的Web网站. 2. 技能要求 熟悉Apache配置文件,能够利用Apache进行建站,并能针对站点使用Apache进行安全加固. 3. 前置条件 1. ...
- 【死磕jeesite源码】Jeesite配置定时任务
一.主要是注意XML文件中设置3个地方和类文件中配置 第一步配置: 第二步配置:注解扫描 第三步配置:开启任务 类中注解配置:如下 @Service 或者Component @Lazy(false) ...
- 我的第一篇paper
找实习虽然只为自己争取到一个秋季的绿色通道,但可喜的是,我投的几篇paper,终于中了一篇. 现在可以在英文数据库或google scholar上面搜索到自己名字,感觉很nice,研究生的心愿算是完成 ...