Hopefully the question will be clear, but for clarity:
I have a VB6 dll that defines an enum which I reference in my C # dll. The C # dll defines CCW in the right way with the idispatch interface, which declares a function that returns a type - this is an enumeration.
When I run regasm, I get a warning that the enum is not COM visible, and therefore the function is not exported. Since it is defined in my VB6 library, I would think that it is already COM visible, since it is defined in the COM dll.
I understand that I can stop messing around and use int to pass the enumeration, and just do the casting, but this is inconvenient, and I would like to know if there is a way.
As requested, an example code is provided:
VB6 dll single enumeration
Public Enum myEnum
first = 0
second = 1
End Enum
This is imported via interop in C #, and if you are viewing metadata, it looks something like this.
[Guid("EnumGUID")]
public enum myEnum
{
first = 0,
second = 1
}
Then the CCW interface is defined
[ComVisible(true)]
[Guid("InterfaceGuid")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IMyCCWInterface
{
[DispId(1)]
myEnum myFunction();
}
Regasm complains that myEnum is not visible. I have to agree with this, since the metadata view does not have the com visible attribute. It is strange if I use other types that are defined in the VB dll for function arguments, I do not receive any complaints, this is just an enumeration, and I suppose this because I will actually make public the inline implementation of the VB6 enumeration, and not the actual enumeration.
So, I think I understand the problem, that I would like to know if there is a way to get this work to use enums that are not related to hacking any intermediate or automatically generated code.