Did you know ... | Search Documentation: |
![]() | Pack ffi -- prolog/cerror.pl |
This module provides common routines to map error codes into apropriate
actions in Prolog. Below is a typical example mapping the statfs()
function:
:- module(libc_files, [ statfs/2 ]). :- use_module(library(cinvoke)). :- c_import("#include <sys/vfs.h>", [ libc ], [ statfs(+string, -struct(statfs), [-int]) ]). statfs(File, FsStat) :- statfs(File, FsStat, Status), posix_status(Status, statfs, file, File).
int
error return status
into a suitable Prolog response. If Code is non-negative the
predicate simply succeeds. For other cases it retrieves the error
code using c_errno/1 and translates the error into a suitable Prolog
exception.errno
code.
The following predicates are exported, but not or incorrectly documented.