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

Julien Fischer jfischer at opturion.com
Sun Jul 14 17:04:02 AEST 2019


On Sun, 14 Jul 2019, Zoltan Somogyi wrote:

> Julien, Peter: I see that the reference manual is silent on how foreign code should
> allocate memory whose address is passed to Mercury code. Since you have more
> experience with interfacing to foreign language code than I do, could one of you
> please take a crack at adding a paragraph about this to the sections dealing
> with the interfaces to C, C#, Java and Erlang?

I'll take a crack at this; for C grades that use GC, it would probably
be best to document the MR_GC_* macros and functions from
runtime/mercury_memory.h in the reference manual.

For C# and Java, nothing special is required (e.g you can just use
the new operator to allocate somthing on the heap).  I'll note
this as well.

Julien.


More information about the users mailing list