Re: Right way of passing unmanaged structures between managed and native code?
From: Vladimir Kouznetsov (vladimir.kouznetsov_at_ngrain.com)
Date: 03/31/04
- Previous message: Ronald Laeremans [MSFT]: "Re: Right way of passing unmanaged structures between managed and native code?"
- In reply to: Ronald Laeremans [MSFT]: "Re: Right way of passing unmanaged structures between managed and native code?"
- Next in thread: Ronald Laeremans [MSFT]: "Re: Right way of passing unmanaged structures between managed and native code?"
- Reply: Ronald Laeremans [MSFT]: "Re: Right way of passing unmanaged structures between managed and native code?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 31 Mar 2004 12:38:27 -0800
Thank you Ronald,
I found the following phrase
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstecha
rt/html/vbtchtroubleshootingnetinteroperability.asp "Troubleshooting .NET
Interoperability"): "Because Visual Studio .NET optimizes the way data is
stored, the unmanaged representation of the structure does not always match
the managed representation". From that I concluded that either alignment or
order of members or both can be different for managed and unmanaged code. If
I'm misinterpreting that, that probably should be clarified. Otherwise if
that is incorrect I'm happy to know that.
thanks,
v
"Ronald Laeremans [MSFT]" <ronaldl@online.microsoft.com> wrote in message
news:eFothx1FEHA.3064@tk2msftngp13.phx.gbl...
> Hi Vladimir,
>
> Unmanaged types are guaranteed to have the same representation regardless
of
> whether they are compiled with or without the /clr switch. What
> documentation or experiment makes you believe otherwise?
>
> Ronald Laeremans
> Visual C++ team
>
> "Vladimir Kouznetsov" <vladimir.kouznetsov@ngrain.com> wrote in message
> news:%23hbHnueFEHA.3032@TK2MSFTNGP09.phx.gbl...
> > Hi group,
> >
> > It seems there are no guarantees that the same unmanaged structures have
> the
> > same binary representation for managed and native code. How do I use
them
> in
> > mixed-code assemblies? Is there just some compiler magic behind curtains
> > (IJW, some implicit marshalling, which can lead to a performance
> > degradation) or the data are binary compatible in these scenarios or I
> > perhaps should use attributes to explicitly specify the layout (which
BTW
> > may depend on compiler switches increasing complexity of maintenance)?
> >
> > thanks,
> > v
> >
> >
>
>
- Previous message: Ronald Laeremans [MSFT]: "Re: Right way of passing unmanaged structures between managed and native code?"
- In reply to: Ronald Laeremans [MSFT]: "Re: Right way of passing unmanaged structures between managed and native code?"
- Next in thread: Ronald Laeremans [MSFT]: "Re: Right way of passing unmanaged structures between managed and native code?"
- Reply: Ronald Laeremans [MSFT]: "Re: Right way of passing unmanaged structures between managed and native code?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|