pragma CPP_Constructor ([Entity =>] LOCAL_NAME [, [External_Name =>] static_string_EXPRESSION ] [, [Link_Name =>] static_string_EXPRESSION ]);
This pragma identifies an imported function (imported in the usual way
Import) as corresponding to a C++ constructor. If
Link_Name are not specified then the
Entity argument is a name that must have been previously mentioned
in a pragma
CPP. Such name
must be of one of the following forms:
Fname(...) `return' T‘
Fname(...) `return' T’Class
T is a limited record type imported from C++ with pragma
The first two forms import the default constructor, used when an object
T is created on the Ada side with no explicit constructor.
The latter two forms cover all the non-default constructors of the type.
See the GNAT User’s Guide for details.
If no constructors are imported, it is impossible to create any objects on the Ada side and the type is implicitly declared abstract.
CPP_Constructor is intended primarily for automatic generation
using an automatic binding generator tool (such as the
See Interfacing to C++ for more related information.
Note: The use of functions returning class-wide types for constructors is currently obsolete. They are supported for backward compatibility. The use of functions returning the type T leave the Ada sources more clear because the imported C++ constructors always return an object of type T; that is, they never return an object whose type is a descendant of type T.