null-terminated a string before passing to a C function

This commit is contained in:
hyung-hwan 2021-10-16 15:19:10 +00:00
parent 3337936c8c
commit d9f957300e
2 changed files with 4 additions and 3 deletions

View File

@ -1,3 +1,3 @@
all: all:
gnat make -gnata hello && valgrind ./hello gnat make -gnata -gnatW8 hello && valgrind ./hello
gnat make -gnata hello2 && valgrind ./hello2 gnat make -gnata -gnatW8 hello2 && valgrind ./hello2

View File

@ -76,7 +76,8 @@ procedure hello2 is
end case; end case;
end is_class; end is_class;
Empty_String: aliased Standard.String := ""; --Empty_String: aliased Standard.String := "en_US.utf8" & Standard.Character'Val(0);
Empty_String: aliased Standard.String := "" & Standard.Character'Val(0);
begin begin
--setlocale (6, Interfaces.C.Strings.To_Chars_Ptr(Empty_String'access)); --setlocale (6, Interfaces.C.Strings.To_Chars_Ptr(Empty_String'access));
setlocale (6, Empty_String'Address); setlocale (6, Empty_String'Address);