-- Errno_Test - Ensure the binding of the C language integer value errno continues to work properly. -- Written in 2023 by Prince Trippy <programmer@verisimilitudes.net>. -- To the extent possible under law, the author(s) have dedicated all copyright and related and -- neighboring rights to this software to the public domain worldwide. -- This software is distributed without any warranty. -- You should have received a copy of the CC0 Public Domain Dedication along with this software. -- If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. with Ada.Text_IO, Interfaces.C, Errno; use type Interfaces.C.Double; procedure Errno_Test is procedure Sqrt (D : Interfaces.C.Double); -- The return value is unimportant and thus is ignored. pragma Import(Convention => C, Entity => Sqrt, External_Name => "sqrt"); begin Sqrt(-1.0); -- This is a simple way to unconditionally set errno to some value other than a zero. Ada.Text_IO.Put(Interfaces.C.Int'Image(Errno)); end Errno_Test;