Problem where a managed C++ dll returns values via parameters to a C# application

I am looking for description or sample code in C++ for how to retrun values via parameters from a managed C++ dll in Visual C++ 2005.

It is no problem to send values from my C# to the managed C++ dll, but return values via parameters dosn't work.

Can anyone send some documentation on this topic

/BR

Nicolaj



Answer this question

Problem where a managed C++ dll returns values via parameters to a C# application

  • rasyadi

    Hi Nicolaj!

    I am not entirely sure I understand what you mean with parameter. If you try to pass/receive values through a reference function argument, this is the principle:

    <C#>

    string s = "InputText";

    MyCppObject.MyFunction(ref s);

     

    <C++>

    void MyFunction(String^% aText) { aText = "OutputText"; };

     

    Kind regards

    Dag



  • Christian Genne

    Can you show as the code that doesn't work Did you use the out specifier in C#

  • Problem where a managed C++ dll returns values via parameters to a C# application