X-Git-Url: http://nitlanguage.org?ds=sidebyside diff --git a/src/compiler/compiler_ffi/light.nit b/src/compiler/compiler_ffi/light.nit index c7e3b0e..1f59771 100644 --- a/src/compiler/compiler_ffi/light.nit +++ b/src/compiler/compiler_ffi/light.nit @@ -14,13 +14,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -# FFI support for the compilers +# Light FFI support for the compiler module light intrude import abstract_compiler intrude import ffi::light_ffi redef class MModule + # `CCompilationUnit` used for nitni signatures and code specific to the compiler var nitni_ccu: nullable CCompilationUnit = null private fun nmodule(v: AbstractCompilerVisitor): nullable AModule @@ -36,19 +37,20 @@ redef class MModule var n = nmodule(v) if n == null then return n.ensure_compile_ffi_wrapper - finalize_ffi_wrapper(v.compiler.modelbuilder.compile_dir, v.compiler.mainmodule) + finalize_ffi_wrapper(v.compiler.toolchain.compile_dir, v.compiler.mainmodule) for file in ffi_files do v.compiler.extern_bodies.add(file) ensure_compile_nitni_base(v) nitni_ccu.header_c_types.add("#include \"{c_name}._ffi.h\"\n") + nitni_ccu.header_c_types.add("#include \n") nitni_ccu.header_c_types.add """ extern void nitni_global_ref_incr(void*); extern void nitni_global_ref_decr(void*); """ var cflags = self.cflags[""].join(" ") - nitni_ccu.write_as_nitni(self, v.compiler.modelbuilder.compile_dir) + nitni_ccu.write_as_nitni(self, v.compiler.toolchain.compile_dir) for file in nitni_ccu.files do var f = new ExternCFile(file, cflags) @@ -82,7 +84,6 @@ redef class AMethPropdef private fun compile_ffi_support_to_c(v: AbstractCompilerVisitor) do var mmodule = mpropdef.mclassdef.mmodule - var mainmodule = v.compiler.mainmodule var amodule = v.compiler.modelbuilder.mmodule2node(mmodule) var mclass_type = mpropdef.mclassdef.bound_mtype @@ -220,6 +221,7 @@ redef class AMethPropdef end redef class CCompilationUnit + # Compile a `_nitni` files, used to implement nitni features for the compiler fun write_as_nitni(mmodule: MModule, compdir: String) do var base_name = "{mmodule.c_name}._nitni"