Skip to content

Support for marshalling optional parameters in [GeneratedComInterface] interfaces #115205

Open
@max-charlamb

Description

@max-charlamb

Currently GeneratedComInterface supports passing COM interfaces as method arguments using [in] and [out] tags but does not support optional COM interface arguments.

Using the the following IDL definition (found in xclrdata.idl) as an example,

HRESULT GetTokenAndScope([out] mdMethodDef* token, [out] IXCLRDataModule **mod);

this could normally be marshalled using a generated interface with a method signature like

[PreserveSig]
int GetTokenAndScope(out uint token, out IXCLRDataModule? mod);

the marshaller will take automatically convert the interface into the native pointer.

However, this method supports passing mod as a nullptr. In this case no COM interface should be marshalled back to the caller. This pattern is not currently supported and requires falling back to manually marshalling the interface.

Related to #66674

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions