ada/9406: Documentation suggestion

Simon Wright
Sun Feb 23 12:17:00 GMT 2003

I've obviously failed to make my point! I'll have another go and shut up ..

This is the present document:

   If the main program is in some language other than Ada, Then you
   may have more than one entry point in the Ada subsystem. You must
   use a special option of the binder to generate callable routines to
   initialize and finalize the Ada units (see Binding with Non-Ada
   Main Programs). Calls to the initialization and finalization
   routines must be inserted in the main program, or some other
   appropriate point in the code. The call to initialize the Ada units
   must occur before the first Ada subprogram is called, and the call
   to finalize the Ada units must occur after the last Ada subprogram
   returns. You use the same procedure for building the program as
   described previously. In this case, however, the binder only places
   the initialization and finalization subprograms into file b~xxx.adb
   instead of the main program. So, if the main program is not in Ada,
   you should proceed as follows:

   1. Compile the other language files to generate object files. For

          gcc -c file1.c
          gcc -c file2.c

   2. Compile the Ada units to produce a set of object files and ALI
      files. For instance:

          gnatmake -c entry_point1.adb
          gnatmake -c entry_point2.adb

   3. Run the Ada binder on the Ada main program. For instance:

          gnatbind -n entry_point1.ali entry_point2.ali

   4. Link the Ada main program, the Ada objects and the other
      language objects. You only need to give the last entry point
      here. For instance:

          gnatlink entry_point2.ali file1.o file2.o

Now (3) and (4) *cannot be right* because this is in a section where
*there is no ada main program*, OK?

My point about Ada subprograms being called indirectly by the non-Ada
main program is not that there might be calls via Ada, which are
obviously going to be handled, but that there might be calls via (a
chain of) non-Ada units, and the user needs to account for them as
well. And for variables (the second line of the first para above talks
about "entry points", a naive user might not recognise that variables

I see your point about partitions though I must say it was far from
obvious that I should be looking there. Perhaps the UM should have a
reference to the RM.

More information about the Gcc-bugs mailing list