Skip to content

HosakaCorp/go-spark

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

Go+Ada SPARK Example

This is an example program for how to interface a Go program with Ada SPARK 2014 functions by using cgo as described here. This uses the example binary_search SPARK example with only a single pragma Export added.

Usage

In order to run this example you will need a working Go environment, Ada (with gnat libraries), and Ada SPARK.

To run proofs, compile Ada libraries, and compile the Go binary run:

make

The proof output will be generated into ./gnatprove/gnatprove.out and the spark_test go binary will be created from the goexample.go source.

This example includes cexample.c that can be used as an example to link Ada SPARK programs into C. Create the C spark_test binary with:

make c

Clean up with:

make clean

Workflow

  1. Export SPARK function to C:
  2. Prove Ada code: gnatprove
  3. Compile Ada code to object file: gnatmake
  4. Create static archive (you could use the .o directly at link time as in the C example): ar rc
  5. Compile Go: go build

About

Go+Ada SPARK Example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published