[m-users.] Yet another piece for the posix library: strerror(3)

Julien Fischer jfischer at opturion.com
Mon Oct 28 19:02:13 AEDT 2019



On Mon, 28 Oct 2019, Volker Wysk wrote:

> Am Montag, den 28.10.2019, 17:27 +1100 schrieb Julien Fischer:
>> 
>> On Mon, 28 Oct 2019, Volker Wysk wrote:
>> 
>> > Am Montag, den 28.10.2019, 16:12 +1100 schrieb Peter Wang:

...

>> > > 
>> > > The standard library makes the same mistake :P
>> > 
>> > It's included in the standard library? What standard library?
>> 
>> Mercury's standard library; it's what the predicate io.make_err_msg
>> ultimately calls.
>
> There is no make_err_msg in the io library. At least, it isn't in the
> library reference manual.

You won't find it the library manual, it's an internal function.

>> > > Also, you should consider using MR_strerror() from the runtime
>> > > directory
>> > > instead of strerror_r() directly.
>> > 
>> > What is the "runtime directory"?
>> 
>> The runtime directory in the Mercury source tree.
>
> You mean, copy the code of MR_strerror and insert it in the posix
> library?


I suspect what Peter mant is, include this in posix.sterror.m.

     :- pragma foreign_decl("C", "#include \"mercury_runtime_util.h\").

and then call MR_strerror() in your foreign_proc body instead of
strerror_r.

Julien.


More information about the users mailing list