C# Make a imported DLL call function from main program who imported it

  .net, .net-assembly, c++, dll, windows

I want to have DLL’s acting like plugins for my project

So, i have my main c# program, and it loads all DLL’s found at a plugins folder using Assembly.LoadFile

Main Program

var DLL = Assembly.LoadFile("test.dll");
foreach (Type type in DLL.GetExportedTypes())
{
    dynamic C = Activator.CreateInstance(type);
    C.Initialize();
}

so, calling Initialize from test.dll works…

but how can i make "test.dll" call a function from the main program ‘program who imported the dll‘?

Source: Windows Questions

LEAVE A COMMENT