@@ -47,7 +47,7 @@ static value Val_handle(void* handle) {
47
47
}
48
48
49
49
static void * getsym (void * handle , const char * module , const char * name ){
50
- char * fullname = caml_stat_strconcat (4 , "caml" , module , "." , name );
50
+ char * fullname = caml_stat_strconcat (3 , module , "." , name );
51
51
void * sym ;
52
52
sym = caml_dlsym (handle , fullname );
53
53
/* printf("%s => %lx\n", fullname, (uintnat) sym); */
@@ -110,25 +110,27 @@ CAMLprim value caml_natdynlink_register(value handle_v, value symbols) {
110
110
111
111
for (i = 0 ; i < nsymbols ; i ++ ) {
112
112
const char * unit = String_val (Field (symbols , i ));
113
- table [i ] = getsym (handle , unit , "frametable " );
113
+ table [i ] = getsym (handle , unit , "gc_roots " );
114
114
if (table [i ] == NULL ) {
115
115
caml_stat_free (table );
116
116
caml_invalid_argument_value (
117
- caml_alloc_sprintf ("Dynlink: Missing frametable for %s" , unit ));
117
+ caml_alloc_sprintf ("Dynlink: Missing gc_roots for %s" , unit ));
118
118
}
119
119
}
120
- caml_register_frametables (table , nsymbols );
120
+ caml_register_dyn_globals (table , nsymbols );
121
+ /* [caml_register_dyn_global] can raise, so do it prior to registering
122
+ frametables etc. */
121
123
122
124
for (i = 0 ; i < nsymbols ; i ++ ) {
123
125
const char * unit = String_val (Field (symbols , i ));
124
- table [i ] = getsym (handle , unit , "gc_roots " );
126
+ table [i ] = getsym (handle , unit , "frametable " );
125
127
if (table [i ] == NULL ) {
126
128
caml_stat_free (table );
127
129
caml_invalid_argument_value (
128
- caml_alloc_sprintf ("Dynlink: Missing gc_roots for %s" , unit ));
130
+ caml_alloc_sprintf ("Dynlink: Missing frametable for %s" , unit ));
129
131
}
130
132
}
131
- caml_register_dyn_globals (table , nsymbols );
133
+ caml_register_frametables (table , nsymbols );
132
134
133
135
for (i = 0 ; i < nsymbols ; i ++ ) {
134
136
const char * unit = String_val (Field (symbols , i ));
0 commit comments