none
What directional attributes are applied to each parameter marshaled through __arglist? RRS feed

  • Question

  • Function signature in C/C++ is:

    void foo(my_struct_t x, ...);
    

    Method signature in C# is:

    [DllImport("mydll.dll"]
    public static extern void foo([In, Out]my_struct_t x, [In, Out]__arglist);
    

    The [In, Out] on all parameters is necessary because foo will modify the structs, and I will need the modified field values. Question is, does [In, Out] propagate to each element in the arg list? For example, if I later call:

    foo(x, __arglist(y, z));
    
    Will y and z also have the [In, Out] applied?

    • Edited by Josh Reeves Sunday, November 6, 2011 6:43 AM
    • Moved by Leo Liu - MSFT Monday, November 7, 2011 8:05 AM Moved for better support. (From:Visual C# Language)
    Sunday, November 6, 2011 4:28 AM

Answers

  • Well, I guess we have an answer here folks:

    Question:does [In, Out] propagate to each element in the arg list?

    Answer: see below

    It means if you changed the values listed in arglist, it will exactly changed and returned.

     


    • Marked as answer by Josh Reeves Wednesday, November 9, 2011 12:39 AM
    • Unmarked as answer by Josh Reeves Wednesday, November 9, 2011 12:41 AM
    • Marked as answer by Josh Reeves Wednesday, November 9, 2011 12:42 AM
    • Edited by Josh Reeves Wednesday, November 9, 2011 12:43 AM
    Wednesday, November 9, 2011 12:39 AM

All replies