[m-users.] foreign_type confusion on how to do it across modules...

Zoltan Somogyi zoltan.somogyi at runbox.com
Mon Jul 15 08:13:41 AEST 2019



On Sat, 13 Jul 2019 19:23:55 -0700, M McDonough <foolkingcrown at gmail.com> wrote:

>  > In C, the allocation should be done with the MR_GC_NEW macro,
> > which is defined in runtime/mercury_memory.h, or its MR_GC_NEW_ATTRIB
> > variant, which help with memory profiling.
> 
> The foreign_proc should unbox the struct (if it's not a pointer type) for
> you in the C function prologue it writes, shouldn't it?

How would the Mercury compiler know what to unbox? Given that most foreign types
are typedef'd names, it has no idea which foreign types are pointers and which are not.

Zoltan.


More information about the users mailing list