Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8422089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:20:27+00:00 2026-06-10T03:20:27+00:00

Background This may be incredibly basic, or it may be completely impossible. Being new

  • 0

Background

This may be incredibly basic, or it may be completely impossible. Being new to COM, I don’t know, and given my limited COM vocabulary, Google has failed me.

I have an ATL/MFC C++ COM object with many data structures defined internally.
I also have a C# project that references this COM object. In C#, I can call the methods exposed via the C++ side .IDL file and get valid results (finally!).

Question

I would like to use the .IDL file to somehow expose the 100 or so C++ data structures to C# (preferably without wrapping each one individually). Then in C#, I would simply populate the appropriate structure and call a COM method passing the data structure into C++.

Basically, I want to reuse the already defined C++ structures in C#. Is this possible? If so, how?

If it matters, I’m using Visual Studio 2010 and .NET 4 Framework.

Thanks a bunch.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:20:29+00:00Added an answer on June 10, 2026 at 3:20 am

    So it turns out I was trying to put the structure in the wrong place in the IDL file. I was trying to add it to the library definition, and for whatever reason, that did not work.

    Placing it in the interface definition ended up working well :

    ...
    interface Icontrol : IDispatch{
    [ 
    uuid(...), 
    version(1.0) ] 
    typedef struct fake
    { 
        int x;
        int y;
        int z;
    } fake; 
    [id(1)] HRESULT open_connection([out,retval] VARIANT_BOOL* result);
    ...
    

    This does not answer the question of what to do if your type does not map 1:1 to a C# type, but at least I can use the C++ defined structures in C#.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this may be obvious, but i didn't set the background to any
I know this may be a dumb question, but my background is more in
This may be a basic C# question, but I'm comming from a C/C++ background.
this may be a simple one, but I don't know the answer..... For testing
First off, I know this may be a very stupid question, so don't shoot
Background: This is a request for something that may not exist yet, but I've
I know this may sounds like a pointless question, but hear me out... I
Sorry i'm new to .net and learning so this may be very simple. I
Okay I know this may sound like any other issues regarding the ListView and
This may seems a silly question for Java developers, however, I'm new to Java,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.