Search code examples
gnat

C Binder Switch in Gnatbind


I was looking at newer versions of the GNAT tools and saw that Gnatbind no longer has a switch for generating the C Binder files, "-C".

Is this binder file no longer necessary for mixed language environments or was it's functionality moved to another switch?


Solution

  • Mixed language projects has nothing to do with it. Binding is an Ada-exclusive. There is no binding in C or C++

    AdaCore chose to remove this switch because:

    • Ada generated code is sufficient (we removed this switch when it was becoming obsolete, so we switched to Ada binding and never had any issues)
    • Keeping the "generate binding in C" would require them to maintain both versions of the binder generation code.
    • That allows for pure Ada-compiled programs.

    And you still can mix C/C++/Ada sources in your project. Bind only occurs if there are some Ada source files in the project ("Ada" must be present in Languages section of the .gpr file and at least one Ada source file must be present too)