Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / July 2005

Tip: Looking for answers? Try searching our database.

Simple Types and Marshalling Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BartMan - 14 Jul 2005 17:44 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.