fn write_globals()

in src/bindgen/language_backend/clike.rs [955:987]


    fn write_globals<W: Write>(&mut self, out: &mut SourceWriter<W>, b: &Bindings) {
        // Override default method to open various blocs containing both globals and functions
        // these blocks are closed in [`write_functions`] that is also overridden
        if !b.functions.is_empty() || !b.globals.is_empty() {
            if b.config.cpp_compatible_c() {
                out.new_line_if_not_start();
                out.write("#ifdef __cplusplus");
            }

            if b.config.language == Language::Cxx {
                if let Some(ref using_namespaces) = b.config.using_namespaces {
                    for namespace in using_namespaces {
                        out.new_line();
                        write!(out, "using namespace {};", namespace);
                    }
                    out.new_line();
                }
            }

            if b.config.language == Language::Cxx || b.config.cpp_compatible_c() {
                out.new_line();
                out.write("extern \"C\" {");
                out.new_line();
            }

            if b.config.cpp_compatible_c() {
                out.write("#endif // __cplusplus");
                out.new_line();
            }

            self.write_globals_default(out, b);
        }
    }