I'm porting d2d1_1.h header file to Delphi and I'm stuck in an interface declaration. In the interface declaration, there are methods redeclared with actual implementation code which calls. Here is an example (I show only relevant part of the code):
// d2d1_1.h line 1522
interface DX_DECLARE_INTERFACE("e8f7fe7a-191c-466d-ad95-975678bda998") ID2D1DeviceContext : public ID2D1RenderTarget
{
// d2d1_1.h line 1715
STDMETHOD_(void, SetRenderingControls)(
_In_ CONST D2D1_RENDERING_CONTROLS *renderingControls
) PURE;
// Lot of declarations ommited for simplicity
// d2d1_1.h line 2149
COM_DECLSPEC_NOTHROW
void
SetRenderingControls(
CONST D2D1_RENDERING_CONTROLS &renderingControls
)
{
return SetRenderingControls(&renderingControls);
}
}; // interface ID2D1DeviceContext
I understand that the second version of the function is just to easy programming. Actually, the object implementating the given interface has no code for that second version. There is no slot in the interface at the binary level (An interface is implemented as an array of pointers to the methods). I can just ignore the second version when porting to Delphi. Can someone confirm my analysis?
Only the method marked with the PURE
(defined as =0
) attribute really exists in the final COM vtable.
The other methods are utility methods/wrappers that contain C/C++ code that can only be used in C/C++ (they will be compiled), so you must not declare them when using another language (delphi, .NET, etc.)