Using C++ application from C#

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

Hi Everyone. I have a legacy C++ app that most certainly won't work if it
was converted to C#. For now, I want to wrap the app in a C++ DLL and use
the app by calling functions within the DLL from a C# GUI. However, I need
to be able to pass a structure of about 50 fields (represented as a class in
C#) to the DLL, and then I need to receive a large array back from the DLL.
Is there a simple way of doing this?


- BEn
 
Check out Marshaling in MSDN. You will have to declare an exact replica of
the structure in C# and marshal the fields appropriately. As for arrays, if
the size of the array is known before-hand, you can specify that to the
Marshaler as well.

-vJ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top