Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / August 2003

Tip: Looking for answers? Try searching our database.

MarshalAsAttribute(UnManagedType.LPArray)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Christopher Pragash - 27 Aug 2003 00:48 GMT
Hello,

I am trying to Marshal an Array consisting of custom Objects from VB.NET to
VB6. The function signature in VB.NET is like the following:

Public Function GetItemArrary (Byval ItemCode as String)  as
<MarshalAsAttribute(UnmanagedType.LPArray)> Array

End Function

When I use "Regasm /tlb DllPath" I registers with a warning which is as
follows:

"Type library exporter warning processing "Classname.GetItemArray' Warning:
The method or field has an invalid ELEMENT_TYPE/NATIVE TYPE combination."

If I try to do an Early Bind, I get a compile time error. But I could do an
late bind and it works fine.

Can anyone gimme any ideas why this is happening.

Thanks in advance,

regards,
Chris
David Stucki [MS] - 27 Aug 2003 22:48 GMT
I don't believe that VB6 can even handle c-style arrays (LPArray gives you
this).  VB arrays are SAFEARRAYs.  If you remove the MarshalAsAttribute do
things work better?

David Stucki
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Christopher Pragash - 27 Aug 2003 22:59 GMT
David,

Thanks for the response. If I remove the Marshalas attribute it gives me an
error when I try to call the function. Actually...Late binding works in VB
with the marshaling attribute as
<marshalasAttribute(UnManagedType.LPArray)>. I myself am a little spell
bound on this one...as even the Safe array aactually does not seem to work
for me!!! Any ideas or suggestions?

thanks,
Chris

> I don't believe that VB6 can even handle c-style arrays (LPArray gives you
> this).  VB arrays are SAFEARRAYs.  If you remove the MarshalAsAttribute do
[quoted text clipped - 4 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.