Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ID3DInclude should have a base interface type #349

Closed
AArnott opened this issue Mar 15, 2021 · 7 comments
Closed

ID3DInclude should have a base interface type #349

AArnott opened this issue Mar 15, 2021 · 7 comments

Comments

@AArnott
Copy link
Member

AArnott commented Mar 15, 2021

The ID3DInclude interface declares no base type:

public interface ID3DInclude
{
	unsafe HRESULT Open([In] D3D_INCLUDE_TYPE IncludeType, [In][Const] PSTR pFileName, [In][Const] void* pParentData, [In][Out] void** ppData, [In][Out] uint* pBytes);

	unsafe HRESULT Close([In][Const] void* pData);
}

Every(?) other interface ultimately derives from IUnknown. Why is this one different? Is this not a COM interface?

@kennykerr
Copy link
Contributor

This is correct. Some API authors regrettably chose to deviate from COM conventions. This interfaces does not provide a way to control lifetime or interface discovery. There are a few other examples like this in the Windows API.

@AArnott
Copy link
Member Author

AArnott commented Mar 15, 2021

Thanks. I guess this means the CLR couldn't produce an RCW for? I wonder what we would do instead.

@mikebattista Did we ever create a list of interesting cases so projection authors could verify correct behavior? If so, this API should probably be on it.

AArnott added a commit to microsoft/CsWin32 that referenced this issue Mar 15, 2021
@kennykerr
Copy link
Contributor

It's basically a group of callback functions. You presumably already support callbacks like WNDENUMPROC. This is basically the same thing but as member functions grouped in a vtable. Heap allocation is not required - you just need to ensure it outlives the API it is being used with.

@AArnott
Copy link
Member Author

AArnott commented Mar 15, 2021

Heap allocation is not required - you just need to ensure it outlives the API it is being used with.

I don't know how to ensure that in C#.

I could perhaps generate this as a struct as I did for all COM interfaces before adding RCW support, but that further complicates my code gen.

@mikebattista
Copy link
Collaborator

Are there any changes required in the metadata here? Or is this just a special case that projections need to handle?

@kennykerr
Copy link
Contributor

I think there's enough info here - there's not base interface - that's your clue.

@sotteson1
Copy link
Contributor

It looks like this is an issue for language projections and not the metadata, so I'm closing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants