ffi: reset FFI compilation result attached to the module
authorJean Privat <jean@pryen.org>
Tue, 15 Jul 2014 16:05:35 +0000 (12:05 -0400)
committerJean Privat <jean@pryen.org>
Wed, 16 Jul 2014 16:05:55 +0000 (12:05 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/common_ffi/common_ffi.nit
src/compiler_ffi.nit

index 9d793e4..302c472 100644 (file)
@@ -24,7 +24,7 @@ import modelbuilder
 
 import nitni
 
-import ffi_base
+intrude import ffi_base
 import extern_classes
 import header_dependency
 import pkgconfig
index b885bc7..14ae43f 100644 (file)
@@ -51,6 +51,15 @@ redef class MModule
                for file in nitni_ccu.files do
                        v.compiler.extern_bodies.add(new ExternCFile(file, c_compiler_options))
                end
+
+               # reset FFI things so the next compilation job, if any, starts with a clean context
+               # FIXME clean and rationalize this
+               nitni_ccu = null
+               compiled_ffi_methods.clear
+               ffi_ccu = null
+               ffi_files.clear
+               compiled_callbacks.clear
+               #Do not reset `foreign_callbacks` and `ffi_callbacks` because they are computed in previous phases
        end
 
        private fun ensure_compile_nitni_base(v: AbstractCompilerVisitor)