Solved

serialization of native C++ object , deserialization of the same object at C# side

Posted on 2007-11-29
3
1,018 Views
Last Modified: 2013-11-06
I have a C++ ActiveX control, which has a method GetEntity().
This method must return an Entity object (which is a bag of string-int properties, to keep things simple).
This method is called by C# application.

Question: how do you pass the object *by value* from C++ code to C# code?
We can assume that both worlds have a definition of an object, and to pass it means to fill fields in C# object by values in C++ object.

I cannot create COM exposed entity and call its method from C# code to retrieve single values because of bad performance of this .

At the moment I am using custom serialization mechanism, which is part of object interface, dumping self to the bit stream, which is then passed as a return value from ActiveX method. C# code then deserializes the stream to the object. This solution is hard to maintain and it is too bulky.

Do you have any other ideas?
0
Comment
Question by:Clarity_Telephony
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 14

Accepted Solution

by:
Daniel Junges earned 500 total points
ID: 20402568
see at: http://www.codeproject.com/KB/cs/OpenNxSerialization.aspx
he explains the native serialization.
0
 
LVL 8

Expert Comment

by:SunnyDark
ID: 23062551
You can use Marshal.PtrToStructure
"Marshals data from an unmanaged block of memory to a managed object. "

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question