I have seen numerous places that communication between Ada/C/C++ is possible using export/import keywords. What about if the Ada function is a generic; is this even possible?
My problem is that I need to reuse some legacy code and we have numerous generic Ada functions. The new layer coming will be written in C++ and I am hoping to be able to export these existing Ada generic functions to a C++ wrapper. (Actually, if the functions aren't global I will need another layer but nevermind that right now.)
If it is NOT possible I will just need to create new individual Ada functions specific to the different types which in turn call the generic. Any thoughts about this approach?
I am definitely a noob with Ada programming so excuse my ignorance. Thanks for the help.
Write a small Ada package whose specification contains the exported subprograms and whose body instantiates those subprograms using the types available in §B.3 Interfacing with C and C++. Don't neglect to call adainit()
and adafinal()
on the C side. More here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With