Solved

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

Posted on 2007-11-29
3
1,013 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

740 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