Documentation for C bindings

parent a649cb7d
Use in C {#flatbuffers_guide_use_c}
==========
The C language binding exists in a separate project named [FlatCC](https://github.com/dvidelabs/flatcc).
The `flatcc` C schema compiler can generate code offline as well as
online via a C library. It can also generate buffer verifiers and fast
JSON parsers, printers.
Great effort has been made to ensure compatibily with the main `flatc`
project.
## General Documention
- [Tutorial](@ref flatbuffers_guide_tutorial) - select C as language
when scrolling down
- General Use in C (the README) <https://github.com/dvidelabs/flatcc/blob/master/README.md>
- The C Builder Interface, advanced <https://github.com/dvidelabs/flatcc/blob/master/doc/builder.md>
## Basic Reflection
The C-API does support reading binary schema (.bfbs)
files via code generated from the `reflection.fbs` schema, and an
[example usage](https://github.com/dvidelabs/flatcc/tree/master/samples/reflection)
shows how to use this. The schema files are pre-generated
in the [runtime distribution](https://github.com/dvidelabs/flatcc/tree/master/include/flatcc/reflection). Extended reflection
## Mutating Reflection
The C-API does not support mutating reflection like C++ does.
Although the following isn't reflection, it is possible to create new
buffers using complex objects from existing buffers as source. This can
be very efficient due to direct copy semantics without endian conversion or
temporary stack allocation.
It is currently not possible to use an existing table or vector of table
as source, but it would be possible to add support for this at some
point.
## Why not integrate with the `flatc` tool?
[It was considered how the C code generator could be integrated into the
`flatc` tool](https://github.com/dvidelabs/flatcc/issues/1), but it
would either require that the standalone C implementation of the schema
compiler was dropped, or it would lead to excessive code duplication, or
a complicated intermediate representation would have to be invented.
Neither of these alternatives are very attractive, and it isn't a big
deal to use the `flatcc` tool instead of `flatc` given that the
FlatBuffers C runtime library needs to be made available regardless.
...@@ -4,8 +4,8 @@ FlatBuffers {#flatbuffers_index} ...@@ -4,8 +4,8 @@ FlatBuffers {#flatbuffers_index}
# Overview {#flatbuffers_overview} # Overview {#flatbuffers_overview}
[FlatBuffers](@ref flatbuffers_overview) is an efficient cross platform [FlatBuffers](@ref flatbuffers_overview) is an efficient cross platform
serialization library for C++, C#, Go, Java, JavaScript, PHP, and Python serialization library for C++, C#, C, Go, Java, JavaScript, PHP, and Python
(C and Ruby in progress). It was originally created at Google for game (Ruby and Swift in progress). It was originally created at Google for game
development and other performance-critical applications. development and other performance-critical applications.
It is available as Open Source on [GitHub](http://github.com/google/flatbuffers) It is available as Open Source on [GitHub](http://github.com/google/flatbuffers)
...@@ -131,6 +131,8 @@ sections provide a more in-depth usage guide. ...@@ -131,6 +131,8 @@ sections provide a more in-depth usage guide.
in your own programs. in your own programs.
- How to [use the generated Go code](@ref flatbuffers_guide_use_go) in your - How to [use the generated Go code](@ref flatbuffers_guide_use_go) in your
own programs. own programs.
- How to [use the generated C code](@ref flatbuffers_guide_use_c) in your
own programs.
- [Support matrix](@ref flatbuffers_support) for platforms/languages/features. - [Support matrix](@ref flatbuffers_support) for platforms/languages/features.
- Some [benchmarks](@ref flatbuffers_benchmarks) showing the advantage of - Some [benchmarks](@ref flatbuffers_benchmarks) showing the advantage of
using FlatBuffers. using FlatBuffers.
......
...@@ -20,17 +20,17 @@ NOTE: this table is a start, it needs to be extended. ...@@ -20,17 +20,17 @@ NOTE: this table is a start, it needs to be extended.
Feature | C++ | Java | C# | Go | Python | JS | C | PHP | Ruby Feature | C++ | Java | C# | Go | Python | JS | C | PHP | Ruby
------------------------------ | ------ | ------ | ------ | ------ | ------ | --------- | ---- | --- | ---- ------------------------------ | ------ | ------ | ------ | ------ | ------ | --------- | ---- | --- | ----
Codegen for all basic features | Yes | Yes | Yes | Yes | Yes | Yes | WiP | WiP | WiP Codegen for all basic features | Yes | Yes | Yes | Yes | Yes | Yes | Yes | WiP | WiP
JSON parsing | Yes | No | No | No | No | No | No | No | No JSON parsing | Yes | No | No | No | No | No | Yes | No | No
Simple mutation | Yes | WIP | WIP | No | No | No | No | No | No Simple mutation | Yes | WIP | WIP | No | No | No | No | No | No
Reflection | Yes | No | No | No | No | No | No | No | No Reflection | Yes | No | No | No | No | No | Basic| No | No
Buffer verifier | Yes | No | No | No | No | No | No | No | No Buffer verifier | Yes | No | No | No | No | No | Yes | No | No
Testing: basic | Yes | Yes | Yes | Yes | Yes | Yes | ? | ? | ? Testing: basic | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ? | ?
Testing: fuzz | Yes | No | No | Yes | Yes | No | ? | ? | ? Testing: fuzz | Yes | No | No | Yes | Yes | No | No | ? | ?
Performance: | Superb | Great | Great | Great | Ok | ? |Superb| ? | ? Performance: | Superb | Great | Great | Great | Ok | ? |Superb| ? | ?
Platform: Windows | VS2010 | Yes | Yes | ? | ? | ? | ? | ? | ? Platform: Windows | VS2010 | Yes | Yes | ? | ? | ? | No | ? | ?
Platform: Linux | GCC282 | Yes | ? | Yes | Yes | ? | ? | ? | ? Platform: Linux | GCC282 | Yes | ? | Yes | Yes | ? | Yes | ? | ?
Platform: OS X | Xcode4 | ? | ? | ? | Yes | ? | ? | ? | ? Platform: OS X | Xcode4 | ? | ? | ? | Yes | ? | Yes | ? | ?
Platform: Android | NDK10d | Yes | ? | ? | ? | ? | ? | ? | ? Platform: Android | NDK10d | Yes | ? | ? | ? | ? | ? | ? | ?
Platform: iOS | ? | ? | ? | ? | ? | ? | ? | ? | ? Platform: iOS | ? | ? | ? | ? | ? | ? | ? | ? | ?
Engine: Unity | ? | ? | Yes | ? | ? | ? | ? | ? | ? Engine: Unity | ? | ? | Yes | ? | ? | ? | ? | ? | ?
......
This diff is collapsed.
...@@ -750,6 +750,7 @@ INPUT = "FlatBuffers.md" \ ...@@ -750,6 +750,7 @@ INPUT = "FlatBuffers.md" \
"Compiler.md" \ "Compiler.md" \
"Schemas.md" \ "Schemas.md" \
"CppUsage.md" \ "CppUsage.md" \
"CUsage.md" \
"GoUsage.md" \ "GoUsage.md" \
"JavaCsharpUsage.md" \ "JavaCsharpUsage.md" \
"JavaScriptUsage.md" \ "JavaScriptUsage.md" \
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
title="Writing a schema"/> title="Writing a schema"/>
<tab type="user" url="@ref flatbuffers_guide_use_cpp" <tab type="user" url="@ref flatbuffers_guide_use_cpp"
title="Use in C++"/> title="Use in C++"/>
<tab type="user" url="@ref flatbuffers_guide_use_c"
title="Use in C"/>
<tab type="user" url="@ref flatbuffers_guide_use_go" <tab type="user" url="@ref flatbuffers_guide_use_go"
title="Use in Go"/> title="Use in Go"/>
<tab type="user" url="@ref flatbuffers_guide_use_java_c-sharp" <tab type="user" url="@ref flatbuffers_guide_use_java_c-sharp"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment