Skip to content

Commit 2c0bd6f

Browse files
committed
Load default Mono configuration file
1 parent b815001 commit 2c0bd6f

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

clr_loader/ffi/mono.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
MonoAssembly* mono_domain_assembly_open(MonoDomain *domain, const char *name);
1515
MonoImage* mono_assembly_get_image(MonoAssembly *assembly);
1616
17+
void mono_config_parse(const char* path);
18+
1719
MonoMethodDesc* mono_method_desc_new(const char* name, bool include_namespace);
1820
MonoMethod* mono_method_desc_search_in_image(MonoMethodDesc *method_desc, MonoImage *image);
1921
void mono_method_desc_free(MonoMethodDesc *method_desc);

clr_loader/mono.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212

1313
class Mono:
14-
def __init__(self, domain=None):
14+
def __init__(self, domain=None, config_file=None):
1515
self._assemblies = {}
16-
initialize()
16+
initialize(config_file=config_file)
1717

1818
if domain is None:
1919
self._domain = _ROOT_DOMAIN
@@ -80,11 +80,18 @@ def __call__(self, ptr, size):
8080
return unboxed[0]
8181

8282

83-
def initialize(path=None, gc=None):
83+
def initialize(config_file, path=None, gc=None):
8484
global _MONO, _ROOT_DOMAIN
8585
if _MONO is None:
8686
_MONO = load_mono(path=path, gc=gc)
87+
88+
if config_file is None:
89+
config_file = ffi.NULL
90+
else:
91+
config_file = config_file.encode("utf8")
92+
8793
_ROOT_DOMAIN = _MONO.mono_jit_init(b"clr_loader")
94+
_MONO.mono_config_parse(config_file)
8895
_check_result(_ROOT_DOMAIN, "Failed to initialize Mono")
8996
atexit.register(_release)
9097

0 commit comments

Comments
 (0)