Commit 2e13998a5cfc1aab599b0ba774ecadb2704d287d

Thomas de Grivel 2023-03-15T14:47:23

cfn

diff --git a/libc3/cfn.c b/libc3/cfn.c
index f33adce..393682d 100644
--- a/libc3/cfn.c
+++ b/libc3/cfn.c
@@ -57,7 +57,7 @@ s_tag * cfn_apply (s_cfn *cfn, s_list *args, s_tag *dest)
       i++;
     }
   }
-  ffi_call(&cfn->cif, FFI_FN(cfn->p), result, arg_values);
+  ffi_call(&cfn->cif, cfn->ptr.f, result, arg_values);
   free(arg_values);
   *dest = tmp;
   return dest;
@@ -91,7 +91,7 @@ s_cfn * cfn_init (s_cfn *cfn)
 s_cfn * cfn_link (s_cfn *cfn)
 {
   assert(cfn);
-  if (! (cfn->p = (void (*) (void)) dlsym(RTLD_DEFAULT, cfn->name.ptr.ps8)))
+  if (! (cfn->ptr.p = dlsym(RTLD_DEFAULT, cfn->name.ptr.ps8)))
     warnx("cfn_link: %s: %s", cfn->name.ptr.ps8, dlerror());
   return cfn;
 }
diff --git a/libc3/types.h b/libc3/types.h
index d0e95cb..54efda1 100644
--- a/libc3/types.h
+++ b/libc3/types.h
@@ -282,7 +282,10 @@ struct call {
 
 struct cfn {
   s_str name;
-  void (*p) (void);
+  union {
+    void (*f) (void);
+    void *p;
+  } ptr;
   u8 arity;
   const s_sym *result_type;
   s_list *arg_types;