Greetings,
When working with managed c++, do you have to do anything special when going
from simple types from managed to unmanaged and vice versa. Or is
marshalling handled automatically for you?
I have seen from several posts that you have to do special conversions for
strings, but what about the other types such as int, long,ect. In my case I
want to save it as a member variable from a managed class into an unmanaged
class's.
(ie:)
// Managed function calls a pointer to a unmanaged class's function.
void TestNum(int newNum)
{
// Call unmanaged class's function.
pMyUnmanagedClass->UpdateNewNum(newNum);
}
void CMyUnmanagedClass::UpdateNewNum(int nNumber)
{
// Do I have to do anything special here????
// Or is this handled through the marshalling?
m_nMemberTest = nNumber;
}
Thanks in advance!
Carl Daniel [VC++ MVP] - 14 Jul 2005 17:55 GMT
> Greetings,
>
[quoted text clipped - 20 lines]
> m_nMemberTest = nNumber;
> }
built-in scalar types char, byte, int, short, long, __int64, double, float
(etc) are all mapped directly across and can simply be copied between
managed and unmanaged.
-cd
BartMan - 14 Jul 2005 19:53 GMT
Thanks! That makes sense.
> > Greetings,
> >
[quoted text clipped - 26 lines]
>
> -cd