How to read a method signature
Each method appears as a return type, a name, and a parameter list. This entry is fromIMessagingModule:
IMessageFilterSubscription. The first parameter is an array of handles to IMessageFilter, the second a single handle to IMessageListener. Neither can be null, because both are spelled * rather than ?.
Three suffixes carry most of the meaning:
IMessageFilter*[] is an array of non-nullable interface handles, and MyStruct?[] an array of nullable struct pointers.
Primitive types
The set of primitives is closed. No more will be added, so new capability arrives as interfaces, structs, enums, and errors instead.Strings
Astring is always UTF-8 and always NUL-terminated. There’s no character type.
A string parameter arrives as a read-only string view. A string you own is a separate type. A nullable string is spelled string?.
Interfaces
An interface is a collection of methods, and the primary unit of an OmniKit API. Interfaces work much as Java interfaces do.Parameter directions
Each parameter has a direction. If none is written, it’sin.
out or inout parameter must be a pointer or an array. void method(out i32 value) isn’t legal.
The difference matters over IPC. For out, the callee sees an unspecified but valid value, so the initial content isn’t transferred. For inout, the initial content is preserved, and so copied to the callee.
Lifetime of parameter pointers
A pointer passed into an OmniKit method is valid only for the dynamic extent of that method. You can’t save it without taking ownership of what it points to.Interface inheritance
Every interface exceptcom.amazon.apmf.IStandard inherits from exactly one other interface. A derived interface includes all its base interface’s methods, and works anywhere the base works. Inheritance therefore forms a tree rooted at IStandard, so an IStandard* can refer to any interface.
Interface handles
An interface is never a value type. You use it through a handle, spelledIFoo* for non-nullable and IFoo? for nullable.
IStandard
IStandard is the root of the interface tree and declares exactly three methods: addRef, release, and tryQueryInterface.
Interfaces are reference counted in native code. addRef adds a reference, release drops one, and an object’s resources are freed when its count reaches zero. In C++ you never call either. The smart pointers in the generated C++, which OmniKit calls the language projection, manage the count for you.
In garbage-collected projections, IStandard has no addRef or release. The collector does that work instead.
QueryInterface
tryQueryInterface asks an object for a handle to another of its interfaces, given one you already hold. You don’t call it directly. The C++ projection wraps it in two type-safe forms on the smart pointer:
Structs
A struct is a value type with the same layout, alignment, and padding rules as a C struct written the same way.sealed means the struct can’t change once published. Altering it changes the hash of every interface that uses it, directly or indirectly.
A struct passed by value as an in parameter may contain only primitives, or fixed-size arrays of primitives. Anything richer must be passed by pointer.
Data objects
Because structs are sealed, OmniKit offers data objects for data that needs to grow. They’re declared withinterface struct.
IDataObject. The fields become methods.
GeographicLocation2 therefore carries latitude() and longitude() as well as altitude().
In the reference, a data object appears as an interface with one accessor per field, plus every accessor it inherits.
Enums
An enum is a sealed value type over a bounded set, with an integer base type. Every value is stated explicitly, and both names and values must be unique.sealed enum MyEnum : string isn’t legal. Enums are sealed for the same reason structs are: a change alters the hash of every interface that uses them.
Data pointers
A pointer to any data type is spelledT* when non-nullable and T? when nullable.
Data pointers are owning value types that behave like std::unique_ptr. There’s no shared pointer for data: interfaces have shared ownership, data has unique ownership, and aliasing is forbidden. Data therefore forms trees, while objects can form arbitrary graphs.
Pointers can chain, so void myMethod(i32**** foo) is legal.
Arrays
Arrays are spelledT[] for any type T, including another array. IMyInterface*[], i8[][], and MyStruct?[] are all legal.
Fixed-length arrays
A fixed-length array has a single size and never heap-allocates. Its size in bytes is the element count times the element size.Errors
Every OmniKit method can fail. Failures are reported out of band, so no error parameter or return value appears in the IDL.Error hierarchy
Error types have reverse-DNS names and are declared in IDL. Every type exceptcom.amazon.apmf.BaseError inherits from exactly one other, so errors form a hierarchy:
com.amazon.apmf. Errors refine without limit, so code catching SecurityError also catches anything derived from it.
Those are the core types. The com.amazon.apmf reference lists the full set, including NoSuchComponentError and NoSuchInterfaceError, which a failed component or interface lookup raises.
Each error carries a type and a message. Only the type is contractual. The message and any other attachment is best-effort, meant for diagnostics.
Catching errors in C++
The C++ projection represents errors as exception classes that behave like any other C++ exception.IError::getTypes() returns the type list from most specific to least. BaseError is omitted as redundant, so an error thrown as MySecurityError reports two entries:
Error translation
OmniKit translates language-level exceptions into OmniKit errors. Astd::range_error becomes OutOfBoundsError, and anything unrecognized becomes ForeignError. Prefer throwing OmniKit errors directly over relying on translation.
IDL to C++ types
apmf::iface:: namespace, followed by the package path. com.amazon.apmf.FileSystemError becomes apmf::iface::com::amazon::apmf::FileSystemError.
Build integration
Declare the packages you consume, and the build generates their C++ projection.name. Link it into whatever target produces your binary, and set compiler flags and include paths on it as usual.
Generated files land under ${CMAKE_CURRENT_BINARY_DIR}/_apmf_ during the build. There’s no separate tool to run, and nothing to check in.
To build a library that can provide an in-process component, use kepler_add_library, which applies the defaults OmniKit requires.

