Call function from c # from within a c ++ dll

0

Situation:

  • I have a project in 3 layers: one for data, one for graphical interface in C # and another in C ++.

  • The c ++ layer is made using the clr support (/ em> Common Language Runtime Support (/ clr)). But I use it as wrapper between my pure C ++ and C # classes. Within this layer I use VTK and ITK.

  • The C # layer makes the call to the others, so it only sees the others. I need to update something that is in a form in the C # layer going through the C ++ layer. C ++ will call the method in the C # form.

I've already researched the issue and found only examples of how to do it using socket between C # and C ++. This option is not very valid for the curve that I have to have in the project.

For referenced C ++ I can submit the form without any problems.

How can I pass the C # function trigger to pure C ++?

{
    FormCollection^ forms = Application::OpenForms;

    XNamespace::FormTeste^ frmTeste;

    for (int i = 0; i < forms->Count; i++)
    {
        if (forms[i]->Name == "FormTeste")
        {
            frmTeste = static_cast<XNamespace::FormTeste^>(forms[i]);
            frmTeste->GetUCCriarPanoramica()->DefinirEstadoCursorAxial(estado);
            break;
        }
    }
}

In CLR I can find the form by name, but pure C ++ does not have access to this information.

    
asked by anonymous 07.11.2016 / 20:12

0 answers