Recent

Author Topic: Problem with Interface decleration  (Read 3860 times)

SonnyBoyXXl

  • Jr. Member
  • **
  • Posts: 57
Problem with Interface decleration
« on: September 19, 2014, 09:35:43 am »
Hi together,
I have a problem with the D3D10 and I think this is a compiler issue.

The ID3D10EffectTechnique interface can not be used with fpc, but the same code works perfect in delphi.
Thats the decleration (from the JSB translation):
Code: [Select]
ID3D10EffectTechnique = class // Cannot use 'interface' as the QueryInterface, AddRef and Release methods are missing.
        function IsValid: LongBool; virtual; stdcall; abstract;

        function GetDesc(out Desc: TD3D10_TechniqueDesc (* out *)
        ): HResult; virtual; stdcall; abstract;

        function GetAnnotationByIndex(Index: LongWord): ID3D10EffectVariable; virtual; stdcall; abstract;

        function GetAnnotationByName(Name: PAnsiChar): ID3D10EffectVariable; virtual; stdcall; abstract;

        function GetPassByIndex(Index: LongWord): ID3D10EffectPass; virtual; stdcall; abstract;

        function GetPassByName(Name: PAnsiChar): ID3D10EffectPass; virtual; stdcall; abstract;

        function ComputeStateBlockMask(out StateBlockMask: TD3D10_StateBlockMask (* __out *)
        ): HResult; virtual; stdcall; abstract;
    end;

I have not tried to do the translation myself, but also not success. this is the original MS Header definition:
Code: [Select]
DECLARE_INTERFACE(ID3D10EffectTechnique)
{
    STDMETHOD_(BOOL, IsValid)(THIS) PURE;
    STDMETHOD(GetDesc)(THIS_ D3D10_TECHNIQUE_DESC *pDesc) PURE;
   
    STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE;
    STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE;
   
    STDMETHOD_(ID3D10EffectPass*, GetPassByIndex)(THIS_ UINT Index) PURE;
    STDMETHOD_(ID3D10EffectPass*, GetPassByName)(THIS_ LPCSTR Name) PURE;
   
    STDMETHOD(ComputeStateBlockMask)(THIS_ _Out_ D3D10_STATE_BLOCK_MASK *pStateBlockMask) PURE;
};
This is a C definitions, so the QueryInterface, AddRef and Release functions are missing, for that JSB is right.

The workaround with the class does work for Delphi, but seems not to work for FPC. when i debug through a example source-code it seems not code is called (but no exception is thrown).

When I define like this
Code: [Select]
ID3D10EffectTechnique = interface
        ['{DB122CE8-D1C9-4292-B237-24ED3DE8B175}']
then i got a SIGSEGV exception calling any methods of the interface, I think that the VMT is not right, cause the IUnknown functions are not existing.

but the debugger says its inherited from IUnknown.


as far as it seems, the sentence in the MSDN "All interfaces derives from IUnknown" is not correct  :o

How to solve this problem, any workaround possible ?



best regards






SonnyBoyXXl

  • Jr. Member
  • **
  • Posts: 57
Re: Problem with Interface decleration
« Reply #1 on: February 18, 2015, 07:13:51 pm »
Hi there,

with fpc 2.7 and the CORBA interface it's working :)

 

TinyPortal © 2005-2018