Recent

Author Topic: inline statement for interface definition  (Read 1918 times)

SonnyBoyXXl

  • New Member
  • *
  • Posts: 44
inline statement for interface definition
« on: February 18, 2015, 07:12:22 pm »
Hi folks,

i have an idea....
I currently working on the DirectX Header translations.
Now there are many codes like this one:
Code: [Select]
STDMETHOD_(void, GetOutput)(
        _Outptr_ ID2D1Image **outputImage
        ) CONST PURE;
   
    COM_DECLSPEC_NOTHROW
    void
    SetInputEffect(
        UINT32 index,
        _In_opt_ ID2D1Effect *inputEffect,
        BOOL invalidate = TRUE
        ) 
    {
       
        ID2D1Image *output = NULL;
        if (inputEffect != NULL)
        {
            inputEffect->GetOutput(&output);
        }
        SetInput(index, output, invalidate);
        if (output != NULL)
        {
            output->Release();
        }
    }
well, the first function (GetOutput) is no problem, a normal definition of a interface function.
but the seconde ( SetInputEffect) is terrible to translate to pascal, no idea how...
if calling this function, in C++ simple the code provided is executed....

So the idea is to add the INLINE function to the interface definition in fpc.

The above could look as:
Code: [Select]
procedure GetOutput(
        out outputImage :ID2D1Image
        ); stdcall;
   
    procedure  SetInputEffect( index:UINT32;
        inputEffect:ID2D1Effect = nil;
         invalidate: boolean = TRUE
        ) ; inline;

so with the INLINE directive the compiler replaces the call with the provided code (which has to be coded in the implementation section).

is this possible ? since the directive do the same for "normal" functions this should be possible for interfaces too I think, even i'm not a compiler-programer  :D

would be a nice feature  8)

PS: sorry for my bad english  O:-)