I have made a c++ mfc project and c# class library the mfc project is compiled using Common Language Runtime Support (/clr), and the c# project is included by reference in side the mfc app. The mfc app has a class called Manage which calls c# functions:
managed.h:
class Managed abstract
{
public:
static void showcswindow(CString name, CString username);
};
managed.cpp:
#include "stdafx.h"
#include "Managed.h"
#using <System.dll>
using namespace System;
using namespace ::gettingdatafromc;
void Managed::showcswindow(CString name,CString sername)
{
services::showwindow(gcnew String(name), gcnew String(sername));
}
c# code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace gettingdatafromc
{
public static class services
{
public static void showwindow(string name, string sername)
{
string _name = name;
string _sername = sername;
}
}
}
when is use the Managed::showcswindow()
in my mfc app it calls directly the c# function I can jump from c++ to c# code.
My question is how to do this but in the opposite way? That is to call c++ from c# and jump to the c++ function location inside the c++ file and execute it.