Returning a collection or array

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • riderman42
    New Member
    • Feb 2010
    • 1

    Returning a collection or array

    Hello,

    I am not sure where to post this question since it's kind of a crossover question

    I currently have a c# program (this might be a vb.net program in the future) that calls a c++ dll

    using the following in the c# program

    [DllImport("foo. dll")]

    public static extern int ChangeIt(string strId, string strTheValue);


    In c++ I have


    __declspec(dlle xport) int ChangeIt(char *pszId, char *pszTheValue)
    {

    code......

    return 1;

    }

    What I want to do is do the same type of extern call but return either a collection or an array

    the current c++ function does an api call to get a collection and is put into an array for use in another part of the application.

    I assume a collection more efficient since .net can handle collections

    but it really does not matter which format I bring it back in.

    Could someone shed some light on how to return a collection and/or an array to.net from c++ using the etern and dllexport method?

    I am sort of aware of the [In, out] method for arrays but could use a better understanding

    Thanks
    Jake
Working...