Debian Codegraph @

README

raw
1 `msgpack` for C
2 ===================
3
4 Version 6.0.0 [![Build Status](https://github.com/msgpack/msgpack-c/workflows/CI/badge.svg?branch=c_master)](https://github.com/msgpack/msgpack-c/actions) [![Build status](https://ci.appveyor.com/api/projects/status/8kstcgt79qj123mw/branch/c_master?svg=true)](https://ci.appveyor.com/project/redboltz/msgpack-c/branch/c_master)
5 [![codecov](https://codecov.io/gh/msgpack/msgpack-c/branch/c_master/graph/badge.svg)](https://codecov.io/gh/msgpack/msgpack-c/branch/c_master)
6
7 It's like JSON but smaller and faster.
8
9 Overview
10 --------
11
12 [MessagePack](http://msgpack.org/) is an efficient binary serialization
13 format, which lets you exchange data among multiple languages like JSON,
14 except that it's faster and smaller. Small integers are encoded into a
15 single byte and short strings require only one extra byte in
16 addition to the strings themselves.
17
18 Example
19 -------
20
21 ```c
22 #include <msgpack.h>
23 #include <stdio.h>
24
25 int main(void)
26 {
27 /* msgpack::sbuffer is a simple buffer implementation. */
28 msgpack_sbuffer sbuf;
29 msgpack_sbuffer_init(&sbuf);
30
31 /* serialize values into the buffer using msgpack_sbuffer_write callback function. */
32 msgpack_packer pk;
33 msgpack_packer_init(&pk, &sbuf, msgpack_sbuffer_write);
34
35 msgpack_pack_array(&pk, 3);
36 msgpack_pack_int(&pk, 1);
37 msgpack_pack_true(&pk);
38 msgpack_pack_str(&pk, 7);
39 msgpack_pack_str_body(&pk, "example", 7);
40
41 /* deserialize the buffer into msgpack_object instance. */
42 /* deserialized object is valid during the msgpack_zone instance alive. */
43 msgpack_zone mempool;
44 msgpack_zone_init(&mempool, 2048);
45
46 msgpack_object deserialized;
47 msgpack_unpack(sbuf.data, sbuf.size, NULL, &mempool, &deserialized);
48
49 /* print the deserialized object. */
50 msgpack_object_print(stdout, deserialized);
51 puts("");
52
53 msgpack_zone_destroy(&mempool);
54 msgpack_sbuffer_destroy(&sbuf);
55
56 return 0;
57 }
58 ```
59
60 See [`QUICKSTART-C.md`](./QUICKSTART-C.md) for more details.
61
62 Usage
63 -----
64
65 ### Building and Installing
66
67 #### Install from git repository
68
69 ##### Using the Terminal (CLI)
70
71 You will need:
72
73 - `gcc >= 4.1.0`
74 - `cmake >= 2.8.0`
75
76 How to build:
77
78 $ git clone https://github.com/msgpack/msgpack-c.git
79 $ cd msgpack-c
80 $ git checkout c_master
81 $ cmake .
82 $ make
83 $ sudo make install
84
85 How to run tests:
86
87 In order to run tests you must have the [GoogleTest](https://github.com/google/googletest) framework installed. If you do not currently have it, install it and re-run `cmake`.
88 Then:
89
90 $ make test
91
92 When you use the C part of `msgpack-c`, you need to build and link the library. By default, both static/shared libraries are built. If you want to build only static library, set `BUILD_SHARED_LIBS=OFF` to cmake. If you want to build only shared library, set `BUILD_SHARED_LIBS=ON`.
93
94 #### GUI on Windows
95
96 Clone msgpack-c git repository.
97
98 $ git clone https://github.com/msgpack/msgpack-c.git
99
100 or using GUI git client.
101
102 e.g.) tortoise git https://code.google.com/p/tortoisegit/
103
104 1. Checkout to c_master branch
105
106 2. Launch [cmake GUI client](http://www.cmake.org/cmake/resources/software.html).
107
108 3. Set 'Where is the source code:' text box and 'Where to build
109 the binaries:' text box.
110
111 4. Click 'Configure' button.
112
113 5. Choose your Visual Studio version.
114
115 6. Click 'Generate' button.
116
117 7. Open the created msgpack.sln on Visual Studio.
118
119 8. Build all.
120
121 ### Documentation
122
123 You can get additional information including the tutorial on the
124 [wiki](https://github.com/msgpack/msgpack-c/wiki).
125
126 Contributing
127 ------------
128
129 `msgpack-c` is developed on GitHub at [msgpack/msgpack-c](https://github.com/msgpack/msgpack-c).
130 To report an issue or send a pull request, use the
131 [issue tracker](https://github.com/msgpack/msgpack-c/issues).
132
133 Here's the list of [great contributors](https://github.com/msgpack/msgpack-c/graphs/contributors).
134
135 License
136 -------
137
138 `msgpack-c` is licensed under the Boost Software License, Version 1.0. See
139 the [`LICENSE_1_0.txt`](./LICENSE_1_0.txt) file for details.