Marshalling ArrayList

Discussion in 'Microsoft VC .NET' started by Saad, Sep 26, 2008.

  1. Saad

    Saad Guest

    Hi,

    I have a struct as follows:

    [StructLayout(LayoutKind::Sequential,CharSet=CharSet::Ansi)]
    public __gc struct STTemp
    {
    public:
    int someint;
    System::Collections::ArrayList* arrTemp;
    };

    Now, i want to marshal this strcuture so that the arraylist gets
    marshalled properly...
    But i dont understand how to use the "MarshalAl" attribute in the case
    of arraylist....

    Any help will be appreciated...

    Thanks in advance...
    Saad.
     
    Saad, Sep 26, 2008
    #1
    1. Advertisements

  2. Saad

    Pavel Minaev Guest

    On Sep 26, 7:09 pm, Saad <> wrote:
    > Hi,
    >
    > I have a struct as follows:
    >
    > [StructLayout(LayoutKind::Sequential,CharSet=CharSet::Ansi)]
    > public __gc struct STTemp
    > {
    > public:
    > int someint;
    > System::Collections::ArrayList* arrTemp;
    >
    > };
    >
    > Now, i want to marshal this strcuture so that the arraylist gets
    > marshalled properly...


    What exactly do you mean by "marshalled properly"? How do you want it
    to be marshalled?
     
    Pavel Minaev, Sep 29, 2008
    #2
    1. Advertisements

  3. Saad

    Saad Guest

    On Sep 29, 1:13 pm, Pavel Minaev <> wrote:
    > On Sep 26, 7:09 pm, Saad <> wrote:
    >
    > > Hi,

    >
    > > I have a struct as follows:

    >
    > > [StructLayout(LayoutKind::Sequential,CharSet=CharSet::Ansi)]
    > > public __gc struct STTemp
    > > {
    > > public:
    > > int someint;
    > > System::Collections::ArrayList* arrTemp;

    >
    > > };

    >
    > > Now, i want to marshal this strcuture so that thearraylistgets
    > > marshalled properly...

    >
    > What exactly do you mean by "marshalled properly"? How do you want it
    > to be marshalled?


    Hi Pavel,

    I have a vector at the unmanaged end....and corresponding to that i
    have taken an arraylist here...in managed world...
    So, now i would like to somehow, marshal the arraylist ( which holds
    objects of another structure ) to the unmanaged vector class....

    Please let me know how can i achieve this? Through custom marshaller ?

    Saad
     
    Saad, Sep 30, 2008
    #3
  4. Saad

    Pavel Minaev Guest

    On Sep 30, 8:46 am, Saad <> wrote:
    > On Sep 29, 1:13 pm, Pavel Minaev <> wrote:
    >
    >
    >
    >
    >
    > > On Sep 26, 7:09 pm, Saad <> wrote:

    >
    > > > Hi,

    >
    > > > I have a struct as follows:

    >
    > > > [StructLayout(LayoutKind::Sequential,CharSet=CharSet::Ansi)]
    > > > public __gc struct STTemp
    > > > {
    > > > public:
    > > > int someint;
    > > > System::Collections::ArrayList* arrTemp;

    >
    > > > };

    >
    > > > Now, i want to marshal this strcuture so that thearraylistgets
    > > > marshalled properly...

    >
    > > What exactly do you mean by "marshalled properly"? How do you want it
    > > to be marshalled?

    >
    > Hi Pavel,
    >
    > I have a vector at the unmanaged end....and corresponding to that i
    > have taken an arraylist here...in managed world...
    > So, now i would like to somehow, marshal the arraylist ( which holds
    > objects of another structure ) to the unmanaged vector class....


    I assume that by vector you mean std::vector here; if so, then there's
    no way you can use the standard .NET P/Invoke marshalling to get it -
    not with ArrayList, not with plain arrays, etc.

    I have to ask, though - since you're using Managed C++, why don't you
    just directly invoke those C++ APIs from your code?
     
    Pavel Minaev, Oct 1, 2008
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Cotgrove

    Marshalling Data Types

    Paul Cotgrove, Nov 26, 2003, in forum: Microsoft VC .NET
    Replies:
    0
    Views:
    276
    Paul Cotgrove
    Nov 26, 2003
  2. Guest

    Data marshalling in C++/CLI <-> C++

    Guest, Feb 18, 2004, in forum: Microsoft VC .NET
    Replies:
    1
    Views:
    640
    Brandon Bray [MSFT]
    Feb 18, 2004
  3. Guest

    C++/CLI and bitfield marshalling

    Guest, Feb 18, 2004, in forum: Microsoft VC .NET
    Replies:
    3
    Views:
    447
    Brandon Bray [MSFT]
    Feb 23, 2004
  4. Guest

    marshalling connection point callback

    Guest, Feb 8, 2005, in forum: Microsoft VC .NET
    Replies:
    0
    Views:
    217
    Guest
    Feb 8, 2005
  5. Guest
    Replies:
    2
    Views:
    466
    Kapil Khosla [MSFT]
    Mar 17, 2005
Loading...

Share This Page