Xamarin Public Jenkins (auto-signing) 73ee7591e8 Imported Upstream version 6.8.0.73
Former-commit-id: d18deab1b47cfd3ad8cba82b3f37d00eec2170af
2019-12-10 18:00:56 +00:00

66 lines
2.2 KiB
C

/* -*- C -*- */
#include <stdlib.h>
static BundleMonoAPI mono_api;
void initialize_mono_api (const BundleMonoAPI *info)
{
if (info == NULL) {
mkbundle_log_error ("mkbundle: missing Mono API info\n");
exit (1);
}
mono_api.mono_register_bundled_assemblies = info->mono_register_bundled_assemblies;
mono_api.mono_register_config_for_assembly = info->mono_register_config_for_assembly;
mono_api.mono_jit_set_aot_mode = info->mono_jit_set_aot_mode;
mono_api.mono_aot_register_module = info->mono_aot_register_module;
mono_api.mono_config_parse_memory = info->mono_config_parse_memory;
mono_api.mono_register_machine_config = info->mono_register_machine_config;
}
#ifdef USE_COMPRESSED_ASSEMBLY
static int
validate_api_pointer (const char *name, void *ptr)
{
if (ptr != NULL)
return 0;
mkbundle_log_error ("mkbundle: Mono API pointer '%s' missing\n", name);
return 1;
}
static void
validate_api_struct ()
{
int missing = 0;
missing += validate_api_pointer ("mono_register_bundled_assemblies", mono_api.mono_register_bundled_assemblies);
missing += validate_api_pointer ("mono_register_config_for_assembly", mono_api.mono_register_config_for_assembly);
missing += validate_api_pointer ("mono_jit_set_aot_mode", mono_api.mono_jit_set_aot_mode);
missing += validate_api_pointer ("mono_aot_register_module", mono_api.mono_aot_register_module);
missing += validate_api_pointer ("mono_config_parse_memory", mono_api.mono_config_parse_memory);
missing += validate_api_pointer ("mono_register_machine_config", mono_api.mono_register_machine_config);
if (missing <= 0)
return;
mkbundle_log_error ("mkbundle: bundle not initialized properly, %d Mono API pointers are missing\n", missing);
exit (1);
}
static void
init_default_mono_api_struct ()
{
#ifdef USE_DEFAULT_MONO_API_STRUCT
mono_api.mono_register_bundled_assemblies = mono_register_bundled_assemblies;
mono_api.mono_register_config_for_assembly = mono_register_config_for_assembly;
mono_api.mono_jit_set_aot_mode = mono_jit_set_aot_mode;
mono_api.mono_aot_register_module = mono_aot_register_module;
mono_api.mono_config_parse_memory = mono_config_parse_memory;
mono_api.mono_register_machine_config = mono_register_machine_config;
#endif // USE_DEFAULT_MONO_API_STRUCT
}
#endif