sep_compiler: add RuntimeFunction::c_fun_ptr
authorJean Privat <jean@pryen.org>
Sat, 7 Feb 2015 15:44:16 +0000 (22:44 +0700)
committerJean Privat <jean@pryen.org>
Sat, 7 Feb 2015 15:44:16 +0000 (22:44 +0700)
Signed-off-by: Jean Privat <jean@pryen.org>

src/compiler/separate_compiler.nit

index 9c03910..66d1162 100644 (file)
@@ -1205,7 +1205,7 @@ class SeparateCompilerVisitor
                end
 
                self.require_declaration(const_color)
-               var call = "(({runtime_function.c_ret} (*){runtime_function.c_sig})({arguments.first}->class->vft[{const_color}]))({ss}) /* {mmethod} on {arguments.first.inspect}*/"
+               var call = "(({runtime_function.c_funptrtype})({arguments.first}->class->vft[{const_color}]))({ss}) /* {mmethod} on {arguments.first.inspect}*/"
 
                if res != null then
                        self.add("{res} = {call};")
@@ -1881,6 +1881,9 @@ class SeparateRuntimeFunction
                return sig.to_s
        end
 
+       # The C type for the function pointer.
+       var c_funptrtype: String is lazy do return "{c_ret}(*){c_sig}"
+
        redef fun compile_to_c(compiler)
        do
                var mmethoddef = self.mmethoddef