You've already forked linux-packaging-mono
Imported Upstream version 5.14.0.93
Former-commit-id: dda284b8de49fb65cd1a403db6a592e6c68a5e8c
This commit is contained in:
parent
fb453ffa72
commit
300ff421ef
61
mcs/tools/mkbundle/template_common.inc
Normal file
61
mcs/tools/mkbundle/template_common.inc
Normal file
@@ -0,0 +1,61 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user