[m-users.] Foreign language interface

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed Sep 14 03:46:37 AEST 2022


2022-09-14 03:28 GMT+10:00 "Volker Wysk" <post at volker-wysk.de>:
> I assume:
> - The foreign predicate is pure, because it is an IO action.
> - The strings in the returned list will be garbage collected.
> - It is necessary to copy them over to Mercury land, like I did. If
>   pointers into the process' environment were handed over to Mercury, they 
>   would possibly get garbage collected, what can't work.

Your assumptions are correct.

Note that the library module io.environment contains several predicates
for accessing the environment, which work when targeting Java and C#
as well as C, and on several operating systems. (This module is new;
it was recently carved out of io.m.)

Zoltan.


More information about the users mailing list