Got past that one too. The array needed to be passed ByRef not ByVal...
(E-Mail Removed) (tcarvin) wrote in message news:<(E-Mail Removed)>...
> I'm having a problem exposing a method from .NET to COM (specifically VB).
>
> I had a pre-existing .NET Assembly that I needed to expose to COM. So
> I created an explicit interface for the classes and methods I wanted to
> expose, and then had my existing .NET classes implement them (pretty much
> I let VS.NET stub out my "implements" routines and then forwarded the calls
> to my existing routines). I used ClassInterface(ClassInterfaceType.None)
> on my classes to force the use of the interfaces.
>
> Now here's the problem. While my simple read-only propertys seem to work,
> I tried calling a method that takes in an array of objects and the VB6
> environment balked with an "unsupported type" error at compile time (plus
> that method's signiture had no "intellisense").
>
> Here's the interface method:
>
> <DispIdAttribute(1)> _
> Function CreateFile(ByVal DbfDir As String, _
> ByVal DbfTitle As String, _
> ByVal FieldDefs() As IFieldDefinition) _
> As IFile
>
> Here's the TypeLib info:
>
> [id(0x00000001)]
> HRESULT CreateFile(
> [in] BSTR DbfDir,
> [in] BSTR DbfTitle,
> [in] SAFEARRAY(IFieldDefinition*) FieldDefs,
> [out, retval] IFile** pRetVal);
>
> I can't see the problem. Any help is appreciated!
> Tom
>
> PS - I posted this in the Interop forum before, but it seems pretty quite
> there. I apologize for the semi-cross-posting.