mixed.adb 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. -- Copyright 2010-2022 Free Software Foundation, Inc.
  2. --
  3. -- This program is free software; you can redistribute it and/or modify
  4. -- it under the terms of the GNU General Public License as published by
  5. -- the Free Software Foundation; either version 3 of the License, or
  6. -- (at your option) any later version.
  7. --
  8. -- This program is distributed in the hope that it will be useful,
  9. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. -- GNU General Public License for more details.
  12. --
  13. -- You should have received a copy of the GNU General Public License
  14. -- along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. with Pck; use Pck;
  16. package body Mixed is
  17. -- We are importing symbols from foo.o, so make sure this object file
  18. -- gets linked in.
  19. Pragma Linker_Options ("foo.o");
  20. type Color is (Red, Green, Blue);
  21. procedure C_Function;
  22. pragma Import (C, C_Function, "c_function");
  23. procedure Callme;
  24. pragma Export (C, Callme, "callme");
  25. procedure Break_Me (Light : Color) is
  26. begin
  27. Put_Line ("Light: " & Color'Image (Light)); -- STOP
  28. end Break_Me;
  29. procedure Callme is
  30. begin
  31. Break_Me (Red);
  32. Break_Me (Green);
  33. Break_Me (Blue);
  34. end Callme;
  35. procedure Start_Test is
  36. begin
  37. -- Call C_Function, which will call Callme.
  38. C_Function;
  39. end Start_Test;
  40. end Mixed;