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++ / August 2006

Tip: Looking for answers? Try searching our database.

Best COM to managed marshaler

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bob - 29 Aug 2006 22:24 GMT
I have a project that uses both managed C# and an unmanaged COM object.  I
would like to know the best way to transfer large chunks of data between the
two?  I have a continuous stream of BYTE arrays that are on average 4k in
size that I need to move from the COM object to C# as fast and efficient as
possible.    I'm thinking either an event that passes in a SafeArray or
using a socket.

Does anyone have any experience with and know what will perform best for me?

Bob
Marcus Heege - 30 Aug 2006 05:56 GMT
If your C# code does not run with restricted CAS permissions, you can use
the C# compiler option /unsafe, the C# keyword unsafe, and byte* types in
your C# code. Using this, you can pass a native pointer from native code to
managed code. This means that noting needs to be copied. On the C# side, you
can either use C++ like pointer arithmetics to iterate throurgh the native
arrray, or you can use the UnmanagedMemoryStream.

Marcus

>I have a project that uses both managed C# and an unmanaged COM object.  I
>would like to know the best way to transfer large chunks of data between
[quoted text clipped - 7 lines]
>
> Bob

Rate this thread:







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.