Advertisement
Guest User

main.adb

a guest
Nov 6th, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 0.56 KB | None | 0 0
  1. WITH Interfaces.C ;       USE Interfaces.C ;
  2.  
  3.  
  4. PROCEDURE main IS
  5.    PRAGMA Linker_Options("hello_world.o") ;
  6.    
  7.    TYPE T_Type IS RECORD
  8.       N : Int ;
  9.       Nom : Char_Array(0..5) ;
  10.    END RECORD ;
  11.    PRAGMA Convention(C,T_Type) ;
  12.  
  13.    PROCEDURE Hello_World_Ada(X: access t_type) ;
  14.    PRAGMA Import(Convention    => C,
  15.                  Entity        => Hello_World_Ada,
  16.                  External_Name => "HelloWorld") ;
  17.    X : aliased T_Type ;
  18. BEGIN
  19.    X.N := 4 ;
  20.    X.Nom := To_C("Bobba") ;
  21.    Hello_World_Ada(x'access) ;
  22. END main ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement