From: Alexis Laferrière Date: Fri, 8 May 2015 13:07:19 +0000 (-0400) Subject: src/ffi: add a check before compiling FFI methods to see if supported X-Git-Tag: v0.7.5~64^2~4 X-Git-Url: http://nitlanguage.org src/ffi: add a check before compiling FFI methods to see if supported Signed-off-by: Alexis Laferrière --- diff --git a/src/compiler/compiler_ffi/light.nit b/src/compiler/compiler_ffi/light.nit index 345377a..c7e3b0e 100644 --- a/src/compiler/compiler_ffi/light.nit +++ b/src/compiler/compiler_ffi/light.nit @@ -98,11 +98,18 @@ redef class AMethPropdef mmodule.ensure_compile_nitni_base(v) end + # Should we compile the extern method `self`? + # + # Returns false when restricting to the light FFI on methods using callbacks. + fun accept_externmeth: Bool do return true + redef fun compile_externmeth_to_c(v, mpropdef, arguments) do # if using the old native interface fallback on previous implementation if n_extern_code_block == null then return super + if not accept_externmeth then return false + var mmodule = mpropdef.mclassdef.mmodule mmodule.uses_ffi = true @@ -164,6 +171,8 @@ redef class AMethPropdef # if using the old native interface fallback on previous implementation if n_extern_code_block == null then return super + if not accept_externmeth then return false + var mmodule = mpropdef.mclassdef.mmodule mmodule.uses_ffi = true