Irvise added by ada-scheme2 on Sat Sep 25 20:38:11 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: package body Scheme_Test is procedure Hello_Ada(Num : Int) is Len : Int; begin Put_Line ("Hello Scheme, from Ada."); Put_Line ("The number passed is: " & Num'Image); -- Can we call Scheme directly here? Len := Hello_Scheme("How is the weather in your interpreter?"); Put_Line("String length sent to Scheme, as computed by Scheme is: " & Len'Image); end Hello_Ada; end Scheme_Test;