In certain Win32 functions and COM methods, some parameters are designated as reserved, indicating that a NULL or nullptr must be passed as an argument, depending on the parameter type.
To enhance the developer experience, these reserved parameters can be abstracted away by the generator, allowing NULL or nullptr to be passed implicitly.
Consider the CoInitializeEx function as an example, currently projected as:
int CoInitializeEx(Pointer pvReserved, int dwCoInit) =>
_CoInitializeEx(pvReserved, dwCoInit);
final _CoInitializeEx = _ole32.lookupFunction<
Int32 Function(Pointer pvReserved, Int32 dwCoInit),
int Function(Pointer pvReserved, int dwCoInit)>('CoInitializeEx');
The first parameter is marked as reserved, with a type of Pointer, indicating that the caller must pass nullptr as an argument:
Here's the proposed projection for this function, abstracting away the reserved parameter and implicitly passing nullptr:
int CoInitializeEx(int dwCoInit) => _CoInitializeEx(nullptr, dwCoInit);
final _CoInitializeEx = _ole32.lookupFunction<
HRESULT Function(Pointer pvReserved, Uint32 dwCoInit),
int Function(Pointer pvReserved, int dwCoInit)>('CoInitializeEx');
With this adjustment, the function can now be called simply as:
In certain Win32 functions and COM methods, some parameters are designated as reserved, indicating that a
NULL
ornullptr
must be passed as an argument, depending on the parameter type.To enhance the developer experience, these reserved parameters can be abstracted away by the generator, allowing
NULL
ornullptr
to be passed implicitly.Consider the CoInitializeEx function as an example, currently projected as:
The first parameter is marked as reserved, with a type of
Pointer
, indicating that the caller must passnullptr
as an argument:Here's the proposed projection for this function, abstracting away the reserved parameter and implicitly passing
nullptr
:With this adjustment, the function can now be called simply as: