Skeleton for topological sort
diff --git a/gen/src/mod.rs b/gen/src/mod.rs
index 3d12c71..d19dea0 100644
--- a/gen/src/mod.rs
+++ b/gen/src/mod.rs
@@ -12,6 +12,7 @@
 mod namespace;
 mod nested;
 pub(super) mod out;
+mod toposort;
 mod write;
 
 pub(super) use self::error::Error;
diff --git a/gen/src/toposort.rs b/gen/src/toposort.rs
new file mode 100644
index 0000000..97b10f9
--- /dev/null
+++ b/gen/src/toposort.rs
@@ -0,0 +1,8 @@
+use crate::syntax::{Api, Types};
+use std::iter::FromIterator;
+
+pub fn sort<'a>(apis: &'a [Api], types: &Types) -> Vec<&'a Api> {
+    // TODO https://github.com/dtolnay/cxx/issues/292
+    let _ = types;
+    Vec::from_iter(apis)
+}
diff --git a/gen/src/write.rs b/gen/src/write.rs
index 2967594..1cd6d07 100644
--- a/gen/src/write.rs
+++ b/gen/src/write.rs
@@ -1,7 +1,7 @@
 use crate::gen::block::Block;
 use crate::gen::nested::NamespaceEntries;
 use crate::gen::out::OutFile;
-use crate::gen::{builtin, include, Opt};
+use crate::gen::{builtin, include, toposort, Opt};
 use crate::syntax::atom::Atom::{self, *};
 use crate::syntax::symbol::Symbol;
 use crate::syntax::{
@@ -76,7 +76,7 @@
         }
     }
 
-    for api in apis {
+    for api in toposort::sort(apis, out.types) {
         match api {
             Api::Struct(strct) => {
                 out.next_section();