Extern types come in three varieties: value types, pointer types, and managed types. An extern class or enum becomes one of these by decorating it with the appropriate metadata (cpp.ValueType, cpp.PointerType, or cpp.ManagedType). The following pages go into detail on each of the three types.
By default, the name of the extern type is used as the native types name, e.g. for extern class Foo {} the native type being externed must be named Foo. However, in C/C++ type names are allowed to start with lower case letters whereas this is not allowed in Haxe. To work around this, you can specify the type name with a string in the extern type metadata. This type field must be a string.
struct foo {};
@:semantics(value) @:cpp.ValueType({ type : "foo" }) extern class Foo {}
C++ types can optionally be scoped in namespaces. The extern type metadata allows you to specify the namespace the externed type is within. This namespace field must be an array of strings.
namespace foo::bar {
struct baz {};
}
@:semantics(value) @:cpp.ValueType({ type : "baz", namespace : [ "foo", "bar" ] }) extern class Baz {}
There is a third optional field, flags, which allows you to configure various options of the extern type. The exact flags available to each extern type and what they do is documented in dedicated page for the extern type.
12.6.8.1: Value Types
12.6.8.2: Pointer Types
12.6.8.3: Managed Types