This document outlines the approaches available for viewing generated FIDL bindings code. For general information about how FIDL definitions get converted to target language code, refer to the bindings reference.
Viewing generated code
If you would like to look at the generated output for a specific target in the
Fuchsia build, you can first build the target in question, then inspect the
generated files in the build output. The instructions in this section assume
that the target is defined using the standard
fidl GN template,
and that the out directory is at the default path (
The root of the FIDL output in the GN build for a library
fuchsia.examples defined in
HLCPP, LLCPP, and C
The C family bindings are further generated into a
fuchsia/examples subdirectory, which comes from the library name. From
- HLCPP outputs
- LLCPP outputs
- C outputs
For example, using
fuchsia.io with the HLCPP bindings creates the
out/default/fidling/gen/sdk/fidl/fuchsia.io/fuchsia/io/cpp/fidl.cc out/default/fidling/gen/sdk/fidl/fuchsia.io/fuchsia/io/cpp/fidl.h out/default/fidling/gen/sdk/fidl/fuchsia.io/fuchsia/io/cpp/fidl_test_base.h
fuchsia.io with the LLCPP bindings creates the following files:
The Rust bindings output is contained in a single file in the root directory.
fuchsia.io is generated to the following file:
Go bindings are generated into an
impl.go file located in a subdirectory in
the root directory. For example, building
fuchsia.io generates the following file:
The JSON IR is generated to the root directory:
The FIDL package for a library named
fuchsia.examples, defined in the directory
The first instance of
fuchsia.examples comes from the path, whereas the second
comes from the library name, so the general pattern would be:
out/default/dartlang/gen/[path to FIDL library]/[FIDL library name]_package
Within the package,
lib/fidl_async.dart contains the bindings code.
lib/fidl_test.dart contains utilities for testing.
For ad hoc examples or existing FIDL files, another option is to use the
fidlbolt tool. By pasting the desired FIDL content into fidlbolt, it is
possible to view the output for each binding, as well as for the JSON IR.
fidlbolt also supports importing libraries defined in the sdk, so that
the FIDL code can use e.g.
using fuchsia.io; to refer to IDK libraries.
Viewing generated documentation
It is possible to generate documentation for generated Rust bindings using