using unmanaged C++Library in .NET

Sep 11 2008 9:07 AM

hello,


I am working on an requirement where .NET application needs to use the unmanaged C++ library(similar to any SDK).
This library has exported api's which can be used to communicates with server. The information/data collected from server by Library is sent over the mail slot to the application consuming this library. The data is not just plain text or numeric value, the entire information is put in an object and its pointer is sent over mail slot.The receiver shall use this pointer type cast it to the respective type and should read the data using the member functions.

The C++ library is published to the customers, it cannot be re-written using latest technologies. Writting the managed wrappers upon the classes of library could not serve the purpose.


Inorder to achieve the above requirement, I have put a COM wrapper above the C++ SDK library. Using the COM interface in .NET application I am able to make a call to API's in C++ library. The query is being posted to the router and the required information is also received by .NET application in the form of an pointer, depending upon the data requested over the mail slot. The pointer recieved over the mail slot has the queried information, which has to be used within .NET applicaiton. I can see the pointer is pointing to some valid location.

The problem i am facing i don't know how to using this un-managed object pointer in .NET application and read the contents of the object.

If any one can point me to the similar post or any reference will be very much helpful.

Thanks in advance.

Santosh


Answers (1)