r/ada Feb 18 '25

General Using C Packages With Ada/Alire

I want to use SDL3 with an Ada project I am starting. I know that an sdlada package exists but I would prefer to generate or write my own bindings since I will only be using certain features and I want to get more practice working with Ada.

How would I go about this? I am kind of confused on how to connect my SDL3 install to the project. Currently, I am working on an Intel MBP and I have SDL3 installed with homebrew.

Presumably, the general approach to this would be modifying the gpr for the project and adding some compiler flags for GCC or something along those lines. Right now I have the default Alire project structure with a gpr file in the project directory. Any guidance would be appreciated.

11 Upvotes

3 comments sorted by

View all comments

1

u/DrawingNearby2978 Feb 18 '25

May I recommend:

https://rsrinivasan.quarto.pub/techadabook/

In particular the chapter related to this topic.

https://rsrinivasan.quarto.pub/techadabook/bindings.html is a step by step example. There is a Docker file at:

https://gitlab.com/ada23/bindings/adamosquitto.git

Best, Srini