Search code examples
.netadagnat

Using .net commands in Ada


I know, it's a noob question but..... I don't know :(

I am using dotnet-gnat, I'm having trouble using the commands of the platform. Net in Ada ... I can use the WriteLine, but the ReadLine command, I can not .... How to know the correct way to use some command?

My code:

with Ada.Text_IO, MSSyst.Console;
use  Ada.Text_IO, MSSyst.Console;

procedure ada_net is
begin
    Put("Ola mundo");
    New_line;
    WriteLine("Ola mundo");
    --ReadLine;
end ada_net;

ReadLine code:

function ReadLine  return access MSSyst.String.Typ'Class;
pragma Export (CIL, ReadLine, "ReadLine");

Thanks.


Solution

  • with
    MSSyst.String,
    MSSyst.Console,
    Ada.Text_IO;
    
    procedure Test is
    begin
       Ada.Text_IO.Put_Line( "Dotnet test." );
       Ada.Text_IO.Put( "Enter a line: " );
       declare
          Line : access MSSyst.String.Typ'Class renames MSSyst.Console.ReadLine; --'
    
          use MSSyst.String;
          Function "&"( Left, Right : access Typ'Class ) return access Typ'Class renames Concat;
          Function "&"( Left : String; Right : access Typ'Class ) return access Typ'Class is
            ( (+Left) & Right );
       begin      
          MSSyst.Console.WriteLine( ("You entered: """ & Line) & (+(1=> '"')));
       end;
    end Test;