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

  • Home
  • SEARCH
  • 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 8622479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:03:56+00:00 2026-06-12T07:03:56+00:00

i am trying to pass an array of struct exported from a c# library

  • 0

i am trying to pass an array of struct exported from a c# library to c++ code. the objective is to pass SAFEARRAY of struct from c++ to c#.

I have followed instructions from

http://limbioliong.wordpress.com/2011/07/16/marshaling-a-safearray-of-managed-structures-by-com-interop-part-2/

but getting this error with the call GetRecordInfoFromTypeInfo

0x80028019 Old format or invalid type library.

  • 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-12T07:03:58+00:00Added an answer on June 12, 2026 at 7:03 am

    If you don’t need to have a dispinterface, following should work:

    void MyMethod([MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)] MyStruct[] data, long size);
    

    If you need to use SAFEARRAY, I would expect following to work (but I am not 100% sure, as I don’t have Windows machine available at the moment):

    void MyMethod([MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_USERDEFINED)] MyStruct[] data);
    

    If you can afford to change your struct to class then this will also work, and save you from UDT hassle:

    void MyMethod([MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_UNKNOWN)] MyStruct[] data);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to pass a pointer to an array of struct. This code should
1.I was trying to pass an array of string from 1 activity to another
I am currently trying to pass an array that I have created in Javascript
I'm trying to pass a byte array from inside my rails app into another
Im trying to pass an array from javascript to java servlet using Jackson, how
I am trying to pass Array from one class to another I used detailViewController.nameArray
I'm trying to pass a C struct from C++ into python as a numpy
Am trying to pass an array of values from PHP function to Javascript. Not
I'm trying to pass an array of unsigned integers from C++ to Ada. The
I have an associative array and I'm trying to pass it to the parameters

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.