Node: Interfacing to C++, Next: , Previous: Interfacing to C, Up: Interfacing to Other Languages

Interfacing to C++

The interface to C++ makes use of the following pragmas, which are primarily intended to be constructed automatically using a binding generator tool, although it is possible to construct them by hand. Ada Core Technologies does not currently supply a suitable binding generator tool.

Using these pragmas it is possible to achieve complete inter-operability between Ada tagged types and C class definitions. See Implementation Defined Pragmas for more details.

pragma CPP_Class ([Entity =>] local_name)
The argument denotes an entity in the current declarative region that is declared as a tagged or untagged record type. It indicates that the type corresponds to an externally declared C++ class type, and is to be laid out the same way that C++ would lay out the type.
pragma CPP_Constructor ([Entity =>] local_name)
This pragma identifies an imported function (imported in the usual way with pragma Import) as corresponding to a C++ constructor.
pragma CPP_Vtable ...
One CPP_Vtable pragma can be present for each component of type CPP.Interfaces.Vtable_Ptr in a record to which pragma CPP_Class applies.