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库以及基本使用的更多相关文章

  1. 【SimpleMsgPack.NET】发布一个msgpack协议C#版本的解析开源库

    这两年一直都关注这IOCP在网络通信这方面的应用,当然数据的传递是经常需要的.今年接触了MsgPack格式,发现他用来做传输时数据打包真是太爽了.因为他可以直接打包二进制数据,不需要任何的转换.有人会 ...

  2. 二进制协议gob及msgpack介绍

    本文主要介绍二进制协议gob及msgpack的基本使用. 最近在写一个gin框架的session服务时遇到了一个问题,Go语言中的json包在序列化空接口存放的数字类型(整型.浮点型等)都序列化成fl ...

  3. 重点关注之自定义序列化方式(Protobuf和Msgpack)

    除了默认的JSON和XML序列化器外,如果想使用其它格式的(比如二进制)序列化器,也是可以的.比如著名的Protobuf和Msgpack,它们都是二进制的序列化器,特点是速度快,体积小.使用方法如下. ...

  4. 序列化库MessagePack应用(C++)

    介绍 MessagePack(简称msgpack)是一个小巧而高效的序列化/反序列化库,支持多种开发语言.官方网站:http://msgpack.org/ . 下面是官方的一个简介: It's lik ...

  5. python之celery的使用(一)

    前段时间需要使用rabbitmq做写缓存,一直使用pika+rabbitmq的组合,pika这个模块虽然可以很直观地操作rabbitmq,但是官方给的例子太简单,对其底层原理了解又不是很深,遇到很多坑 ...

  6. Pyhon进阶9---类的继承

    类的继承 基本概念 定义 格式如下 继承中的访问控制 class Animal: __CNOUT = 0 HEIGHT = 0 def __init__(self,age,weight,height) ...

  7. ZMQ和MessagePack的简单使用(转)

    近段日子在做一个比较复杂的项目,其中用到了开源软件ZMQ和MessagePack.ZMQ对底层网络通信进行了封装,是一个消息处理队列库, 使用起来非常方便.MessagePack是一个基于二进制的对象 ...

  8. python之celery使用详解一

    前段时间需要使用rabbitmq做写缓存,一直使用pika+rabbitmq的组合,pika这个模块虽然可以很直观地操作rabbitmq,但是官方给的例子太简单,对其底层原理了解又不是很深,遇到很多坑 ...

  9. django-redis 中文文档

    Andrey Antukh, niwi@niwi.be 4.7.0 翻译: RaPoSpectre 1. 介绍 django-redis 基于 BSD 许可, 是一个使 Django 支持 Redis ...

随机推荐

  1. python实现合并两个文件并打印输出

    # python实现合并两个文件并打印输出 import fileinput file_Path1 = input("请输入第一个合并文件:") file_Path2 = inpu ...

  2. app 调用接口

    app 调用接口 /// <summary> /// 是否跳转到活动注册成功页面 /// </summary> /// <returns></returns& ...

  3. cp显示进度条

    cp显示进度条 alias cp='rsync -av --progress'

  4. fputc和putc和putchar函数的用法

    功 能: 输出一字符到指定流中 putc()与fputc()等价.不同之处为:当putc函数被定义为宏时,它可能多次计算stream的值. 关于fputc(): 原型:int fputc(char c ...

  5. [Node.js] 06 - Multi-thread and process module

    课前阅读:关于Node.js后端架构的一点后知后觉 书推荐:<Node.js design patterns> 衍生问题: 微服务的必要性,Flux架构 容错性和拓展性 一.立体拓展 假设 ...

  6. iOS - UIAlertController三种显示提示框代码

    UIAlertView在IOS 8以上版本已经过时了,官方推荐我们使用UIAlertController代替UIAlertView.UIActionSheet 1、UIAlertController显 ...

  7. 【netcore基础】MVC API接口权限控制Attribute

    效果: 通过Attribute来简单控制某个方法的访问权限 例如: 下面api只能角色id是[001,002,999]的登录用户才能访问 /// <summary> /// 管理用户列表 ...

  8. Failed to resolve: com.android.support:appcompat-v7:27.0.1问题解决

    今天,在毫无征兆的情况下AndroidStudio又抽风了,搞了大半天,试了网上众多方案,终于解决了这个问题.咱们一步一步来 第一步:这是最开始的bug Error:Failed to resolve ...

  9. JS正则校验

    /** 用途:检查输入字符串是否为空或者全部都是空格 输入:str:字符串 返回: 如果全是空返回true,否则返回false */ function isNull(str) { if (str == ...

  10. OpenJDK与JDK的区别分析

    一.以下是具体分析: 以下内容转自http://fgh2011.iteye.com/blog/1771649: 使用过LINUX的人都应该知道,在大多数LINUX发行版本里,内置或者通过软件源安装JD ...