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?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Paul Cotgrove

    Marshalling Data Types

    Paul Cotgrove, Nov 26, 2003, in forum: Microsoft VC .NET
    Replies:
    0
    Views:
    604
    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:
    880
    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:
    673
    Brandon Bray [MSFT]
    Feb 23, 2004
  4. Guest

    marshalling connection point callback

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

    Simple Types and Marshalling Question

    Guest, Jul 14, 2005, in forum: Microsoft VC .NET
    Replies:
    2
    Views:
    388
    Guest
    Jul 14, 2005
  7. bonk

    Books, Atricles, Websites on Marshalling

    bonk, Jan 19, 2006, in forum: Microsoft VC .NET
    Replies:
    2
    Views:
    203
    Mattias Sjögren
    Jan 19, 2006
  8. Kelvin Johnson

    marshalling c style command line arguments

    Kelvin Johnson, Nov 3, 2008, in forum: Microsoft VC .NET
    Replies:
    2
    Views:
    782
    Giovanni Dicanio
    Nov 4, 2008
Loading...