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. 如何解决:对应的服务器 tls 为 tls 1.0,小程序要求的TLS版本必须大于等于1.2问题

    微信小程序 TLS 版本必须大于等于1.2问题解决 此问题最近在微信小程序开发中,比较常见. 在解决这个问题之前,我们需要了解一下,当前的系统环境是否支持TLS1.2以上,可以参考一下表格: 请先确认 ...

  2. mercurial的几个易用性小技巧

    其实这两年,能够采用mercurial的项目我都尽量用,甚至有些上游是git的,或者需要托管到公司内gitlab上与别人协作的,我都装上hg-git.无它,只是因为mercurial易用性比git好得 ...

  3. Vue.js常用指令:v-bind

    一.什么是v-bind指令 v-bind指令用于响应更新HTML特性,允许将一个或多个属性动态绑定到表达式.v-bind是应用在动态属性上面的. 二.语法 v-bind语法如下: v-bind:动态属 ...

  4. github管理开发代码流程

    首先.通过github网站新建一个仓库,得到仓库地址 https://github.com/piercalex/a.git 接着回到客户端,打开git shell: //在客户端配置账户信息 git ...

  5. c# 正则匹配对称括号

    https://stackoverflow.com/questions/7898310/using-regex-to-balance-match-parenthesis

  6. 阿里云中ssl配置(nginx安装https服务)

    1.配置 a.阿里云服务器 b.安装了nginx,php等 2.申请免费ssl证数 a. b. c.产看ssl证数 d.下载证数 e,这里我下载的是nginx(crt与key文件) f.服务器上配置 ...

  7. SSM框架搭建教程(从零开始,图文结合)

    1.准备 IntelliJ IDEA Tomcat JDK Maven mysql spring.springmvc.mybatis 了解 现在假设如上条件你都具备,那么通过我这篇博客 你一定可以整合 ...

  8. 使用kill -9 进程ID杀死jps中进程

  9. mac yarn 安装

    通过HomeBrew安装 brew install yarn 升级yarn brew upgrade yarn 查看版本 yarn -v 1.15.2

  10. centos linux7的一些操作

    进入centos7的一些界面后,按ctrl+alt+F2,则可进入全shell界面,不过要登录root的密码: 从全shell转为gnome 界面窗口,按alt+F1: *************** ...