Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2007-11-29
3
Medium Priority
?
1,028 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
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…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

722 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