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 2006

Tip: Looking for answers? Try searching our database.

ATL COM client can't understand arrays of structs exposed by .NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
krzys - 08 Aug 2006 04:10 GMT
I have a client written in C++ as a ATL COM application and a server in C#
that lives inside a CLR hosted by this client. The C# server defines a
COM-visible structure and an interface with a method that returns an array of
such structures, such as below. When the C++ host calls the method, I get
"0x80028019 Old format or invalid type library". This despite the fact that
the type library and headers included by the host are just freshly generated
by Visual Studio. What could be wrong with this scenario?

For details, see below.

This is what my .NET server exposes.

   [ComVisible(true)]
   public struct ObjectID
   {
    private Int64 identifier;
    private Int32 type;
    private Int32 attributes;
    private string name;
   }

   [ComVisible(true)]
   public interface IService
   {
    bool GetObjects([In] Int64 context, [Out] out ObjectID[] objects);
   }

The C++ client hosting the .NET server consumes the tlb as below.

   #import "C:\QuickSilver\QuickSilver_Service.tlb" raw_interfaces_only
high_property_prefixes("_get", "_put", "_putref") rename_namespace("QSS")
krzys - 08 Aug 2006 04:16 GMT
Never mind that I made fields private, doesn't work either way. Below is a
piece of the header file generated from teh type library. To me this looks
perfectly valid and I have no clue what's going on.

struct __declspec(uuid("2ac5e284-1855-300e-bb24-28a51e6ffa37"))
ObjectID
{
   __int64 identifier;
   long type;
   long attributes;
   LPSTR name;
};

struct __declspec(uuid("ef585848-5d81-30fb-a8ac-0d797b977f26"))
IService : IDispatch
{
     virtual HRESULT __stdcall GetObjects (
       __int64 context, SAFEARRAY * * objects, VARIANT_BOOL * pRetVal ) = 0;
};

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.