:- module(cmem, [malloc/2, free/1]).

foreign(malloc, c, malloc(+integer, [-address])).
foreign(free, c, free(+address)).

% it is really in libc, but I don't know how to dynamically load that ...

foreign_file(library(system(libpl)), [malloc,free]).

:- load_foreign_executable(library(system(libpl))),
   abolish(foreign_file, 2),
   abolish(foreign, 2).
