Given this example:
Interface dll header
Interface dll cpp for type creation onlyCode:namespace Foo { ref struct SomeStruct; public interface class ISomeInterface { SomeStruct ^ GetStruct(); } }
Impl dll - has a reference to interface dll in the projectCode:#include "ISomeInterface.h"
This code does not compile. The compiler complains that GetStruct() return type does not match that of the interface return type. This in turn causes the compiler to yell about InterfaceImpl not implementing ISomeInterface.Code:namespace Foo { struct SomeStruct { int someValue; }; public ref class InterfaceImpl : ISomeInterface { SomeStruct ^ GetStruct() { return gcnew SomeStruct(); } } }
This seems to only happen on forward declarations that are used as managed pointers. Why does the compiler say that InterfaceImpl::GetStruct() is not the implementation of ISomeInterface::GetStruct()?
Two things I notice:
- SomeStruct is not visible in ISomeInterface.dll in the object browser
- Since SomeStruct is a simple forward declaration to make the compiler happy and the type obviously is not created as evidenced by the above bullet point...how then is it complaining that the signature of the impl does not match the signature of the interface?



LinkBack URL
About LinkBacks


