PC Review


Reply
Thread Tools Rate Thread

Problem with .NET Array and TlbExp (10/12)

 
 
tcarvin
Guest
Posts: n/a
 
      12th Oct 2004
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.
 
Reply With Quote
 
 
 
 
tcarvin
Guest
Posts: n/a
 
      13th Oct 2004
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Article : Tlbexp .exe and Regasm.exe (.Net FrameWork Tools Series) Namratha Shah \(Nasha\) Microsoft VB .NET 0 5th Nov 2004 07:34 AM
Article : Tlbexp .exe and Regasm.exe (.Net FrameWork Tools Series) Namratha Shah \(Nasha\) Microsoft VC .NET 0 5th Nov 2004 07:34 AM
Article : Tlbexp .exe and Regasm.exe (.Net FrameWork Tools Series) Namratha Shah \(Nasha\) Microsoft Dot NET Framework 0 5th Nov 2004 07:31 AM
is tlbexp working properly? Buddhike de Silva Microsoft Dot NET Framework 0 28th Nov 2003 04:19 AM
tlbexp BUG? Buddhike de Silva Microsoft Dot NET Framework 0 28th Nov 2003 04:18 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:10 PM.