Skip to content

Commit 37ed75a

Browse files
authored
Cast +load IMP to the correct function signature (#359)
WebAssembly does a runtime check of the function signature and aborts in case of a mismatch.
1 parent 7a5114d commit 37ed75a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

class_table.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <stdlib.h>
1313
#include <assert.h>
1414

15+
typedef void (*loadIMP)(Class, SEL);
16+
1517
void objc_init_protocols(struct objc_protocol_list *protos);
1618
void objc_compute_ivar_offsets(Class class);
1719

@@ -54,7 +56,7 @@ PRIVATE void objc_send_load_message(Class class)
5456
{
5557
if (load_messages_table_get(load_table, m->imp) == 0)
5658
{
57-
m->imp((id)class, loadSel);
59+
((loadIMP)m->imp)(class, loadSel);
5860
load_messages_insert(load_table, m->imp);
5961
}
6062
}

0 commit comments

Comments
 (0)