10.4. The External Symbol Naming Scheme of XGC Ada

In order to interpret the output from XGC Ada, when using tools that are originally intended for use with other languages, it is useful to understand the conventions used to generate link names from the Ada entity names.

All names are in all lower-case letters. With the exception of library procedure names, the mechanism used is simply to use the full expanded Ada name with dots replaced by double underscores. For example, suppose we have the following package spec:


package QRS is MN : Integer; end QRS;

The variable MN has a full expanded Ada name of QRS.MN, so the corresponding link name is qrs__mn. Of course if a pragma Export is used this may be overridden:


package Exports is
Var1 : Integer;
pragma Export (Var1, C, External_Name => "var1_name");
Var2 : Integer;
pragma Export (Var2, C, Link_Name => "var2_link_name");
end Exports;

In this case, the link name for Var1 is var1_name, and the link name for Var2 is var2_link_name.

One exception occurs for library level procedures. A potential ambiguity arises between the required name _main for the C main program, and the name we would otherwise assign to an Ada library level procedure called Main (which might well not be the main program).

To avoid this ambiguity, we attach the prefix _ada_ to such names. So if we have a library level procedure such as


procedure Hello (S : String);

the external name of this procedure will be _ada_hello.