[WinAPI] Problem with an interface...
Sascha Katzner
sorry.no at spam.invalid
Thu Nov 22 04:37:51 PST 2007
Hi,
I'm not sure if this is a bug in the way D handles interfaces or if I
misunderstand something. I was trying to translate the Direct3D 10
headers for the Windows API project:
http://www.dsource.org/projects/bindings/browser/trunk/win32/directx
I have a Windows function (GetTechniqueByName), which returns a pointer
to an interface (which in D results to a simple interface, because in D
interfaces are allready reference types).
> ID3D10EffectTechnique GetTechniqueByName(LPCSTR Name);
>
> interface ID3D10EffectTechnique {
> extern(Windows) :
> BOOL IsValid();
> HRESULT GetDesc(D3D10_TECHNIQUE_DESC* pDesc);
> ID3D10EffectVariable GetAnnotationByIndex(UINT Index);
> ID3D10EffectVariable GetAnnotationByName(LPCSTR Name);
> ID3D10EffectPass GetPassByIndex(UINT Index);
> ID3D10EffectPass GetPassByName(LPCSTR Name);
> HRESULT ComputeStateBlockMask(D3D10_STATE_BLOCK_MASK* pStateBlockMask);
> }
If I try subsequently to call a function from this interface something
very strange happens, the call results in the very next function from
the interface declaration being called. For example if I call
"technique.IsValid()" D calls GetDesc(), which results in an access
violation.
This behavior appears only to happen with interfaces which are NOT
derived from IUnknown.
I have attached a stripped down version of my source attached to this
posting and a compiled version with debug info can be found at:
http://sascha.katzner.de/misc/interface.exe
LLAP,
Sascha Katzner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: interface.rar
Type: application/octet-stream
Size: 858 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20071122/f2134dfd/attachment.obj>
More information about the Digitalmars-d
mailing list