Giter Club home page Giter Club logo

ada_scheme_example's Introduction

Ada - Scheme example

An example application of Scheme calling into Ada, and Ada calling back to Scheme.

Build instructions

For the time being, it only supports GPRBuild (Ada) and Chicken Scheme. The quickest way to build it is to have both tools installed and run:

make

That will create an executable in the root folder called scheme_ada. Run it and see what you get.


The more manual approach would be to execute the gprbuild (Ada build tool) and csc (Chicken compiler) separately in the root folder.

gprbuild -Pscheme.gpr

csc chicken_ada.scm -L./lib -L -lscheme_hello -Wl,-R./lib -v -o scheme_ada

GNATTools

For the time being, the GNATTools toolsuite is not working. I am having tremendous issues with the linking step. Everything else seems to function. The Makefile is of horrible quality, but it has automatic detection of gprbuild. If it is not present in the system, it tries to use GNATTools.

Explanation

We have a piece of Ada code (the .ads, .adb files in ./src) that is built as a dynamic library, which is placed under ./lib. Then we have a small Scheme file chicken_ada.scm in the root of the project.

The Ada code contains a procedure called hello_ada which is exported as a C function. In Scheme, we write the prototype of that function so that it can be called. At the same time, in Scheme we create a Scheme function, hello_scheme that will be exported as a C function. During the execution of hello_ada, we call hello_scheme to fully prove the interoperability.

Acknowledgments

I would like to thank the #chicken community for dealing with my questions and mistakes. Specially jjhoo.

I would also like to thank the #ada community and specially onox, who found the missing link.

ada_scheme_example's People

Contributors

irvise avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.