import c
import cpp
import java
+import extra_java_files
redef class MModule
# Does this module uses the FFI?
# Complete the compilation of the FFI code
fun finalize_ffi_wrapper(compdir: String, mainmodule: MModule)
do
- for language in present_languages do if ffi_callbacks.keys.has(language) then
+ 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
ffi_ccu.header_c_base.add( "#include \"{mmodule.name}._nitni.h\"\n" )
+ ffi_ccu.body_decl.add("#ifdef ANDROID\n")
+ ffi_ccu.body_decl.add(" #include <android/log.h>\n")
+ ffi_ccu.body_decl.add(" #define PRINT_ERROR(...) (void)__android_log_print(ANDROID_LOG_WARN, \"Nit\", __VA_ARGS__)\n")
+ ffi_ccu.body_decl.add("#else\n")
+ ffi_ccu.body_decl.add(" #define PRINT_ERROR(...) fprintf(stderr, __VA_ARGS__)\n")
+ ffi_ccu.body_decl.add("#endif\n")
+
for nclassdef in n_classdefs do
# Does it declares an extern type?
if nclassdef isa AStdClassdef and nclassdef.n_extern_code_block != null then
end
end
-redef class AExternPropdef
+redef class AMethPropdef
private var ffi_has_been_compiled = false
# Compile the necessary wrapper around this extern method or constructor