- # Callbacks used locally
- var ffi_callbacks = new HashMap[FFILanguage, Set[NitniCallback]]
+ # Complete the compilation of the FFI code
+ fun finalize_ffi_wrapper(compdir: String, mainmodule: MModule)
+ do
+ for language in ffi_callbacks.keys do
+ for callback in ffi_callbacks[language] do
+ language.compile_callback(callback, self, mainmodule, ffi_ccu.as(not null))
+ end
+
+ language.compile_to_files(self, compdir)
+ end
+
+ # include dependancies FFI
+ for mod in header_dependencies do
+ if mod.uses_ffi then ffi_ccu.header_custom.add("#include \"{mod.name}._ffi.h\"\n")
+ end
+
+ ffi_ccu.write_as_impl(self, compdir)
+ for filename in ffi_ccu.files do ffi_files.add(new ExternCFile(filename, c_compiler_options))
+ end
+
+ # Avoid the compile a ffi propdef more than once
+ # See `AMethPropdef::compile_ffi_method`
+ # FIXME find a better way
+ private var compiled_ffi_methods = new HashSet[AMethPropdef]
+end
+
+redef class AModule