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 / July 2007

Tip: Looking for answers? Try searching our database.

Tlbimp: unexpected conversion of SAFEARRAY in structure

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Armin Zingler - 19 Jul 2007 00:00 GMT
Hi,        (.Net 2.0)

an AX-DLL written in VB6 is imported by tlbimp.

VB6 code:

   Public Type SAKomplexRecord
   ....
   End Type

   Public Type SAKomplex
      Records() As SAKomplexRecord
   End Type

IDL: (from original VB6 DLL)
   typedef [uuid(.....), version(1.0)]
   struct tagSAKomplex {
       [helpstring("Records")
   ]
       SAFEARRAY(SAKomplexRecord) Records;
   } SAKomplex;

   typedef [uuid(.....), version(1.0)]
   struct tagSAKomplexRecord {
   .....
   } SAKomplexRecord;

Problem:
   In VB.Net, referencing the imported file, the declaration of
   SAKomplex.Records is
       "Public Records As System.Array".
   I expect it to be
       "Public Records() As Projectname.SAKomplexRecord".

Why is this? In the same library, there is another structure containing an
array of structures. There it works.

Armin
Armin Zingler - 19 Jul 2007 01:01 GMT
> Hi,        (.Net 2.0)
>
> an AX-DLL written in VB6 is imported by tlbimp.

I assumed that the Upgrade wizard that converts a VB6 project to VB.Net,
internally only calls tlbimp.exe. That's why I asked for tlbimp.exe. In
reality, I used the upgrade wizard (and not tlbimp), which obviously
internally uses "/sysarray" to create the interop assemblies.

If I manually call tlbimp.exe, the result is fine, so this problem is
solved. Anyway thx for reading.

Armin

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.