How does one declare a runtime interface that inherits from Windows.Foundation.IClosable
in C++/CX?
Both of these attempts produce compiler errors:
public interface class MyInterface : Windows::Foundation::IClosable {
/* bla bla */
};
==> error C2039: 'IClosable' : is not a member of 'Windows::Foundation'
and
public interface class MyInterface {
/* bla bla */
~MyInterface();
};
==> error C2849: 'MyInterface' : an interface cannot have a destructor
Yet it cannot be that such inheritance is categorically forbidden in Windows Runtime, because some system-provided interfaces do inherit from IClosable
-- for example, IInputStream
.
I suppose I could define MyInterface
in IDL instead and convert it into an external .winmd
file with midlrt.exe before I compile the C++ code. That would be an unwelcome compilcation of my build process, though. Is there a way to specify this as C++/CX source?