Welcome to the CHICKEN Scheme pasting service

Ada-scheme added by Irvise on Sat Sep 25 20:32:32 2021

SCHEME:

(import (chicken foreign))

;; Importing from Ada
(define hello-in-ada
  (foreign-safe-lambda void "hello_ada" int))

;; Callable from the outside, returns an int
(define-external
  (hello_scheme
   (c-string message))
  int
  (
   (print "Hello from Scheme! The message was: \n")
   (print message)
   (print "The message length was:" (string-length message))
   (string-length message)
   )
  )

(hello-in-ada 1337)

ADA:
SPECIFICATION FILE (HEADER):

with Ada.Text_IO; use Ada.Text_IO;
with Interfaces.C; use Interfaces.C;

package Scheme_Test is
   
   procedure Hello_Ada(Num : Int)
   with
     Export => True,
     Convention => C,
     External_Name => "hello_ada";
   
   function Hello_Scheme (String : Char_Array) return Int
   with
	 Import => True,
	 Convention => C,
	 External_Name => "hello_scheme";
   
end Scheme_Test;

BODY THAT IS GETTING EXECUTED:

with Ada.Text_IO; use Ada.Text_IO;
with Interfaces.C; use Interfaces.C;

package Scheme_Test is
   
   procedure Hello_Ada(Num : Int)
   with
     Export => True,
     Convention => C,
     External_Name => "hello_ada";
   
   function Hello_Scheme (String : Char_Array) return Int
   with
	 Import => True,
	 Convention => C,
	 External_Name => "hello_scheme";
   
end Scheme_Test;

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
What is the operator to construct pairs?
Visually impaired? Let me spell it for you (wav file) download WAV