Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8878695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:46:29+00:00 2026-06-14T19:46:29+00:00

I am working on an extension for a project that will allow hosting the

  • 0

I am working on an extension for a project that will allow hosting the CLR inside the core application. With this I plan to allow this extension to manage managed extensions that it loads/unloads inside itself. That being said, I need to use separate AppDomains to ensure unloading is possible.

Currently, I am able to get the domains setup and get the plugin file loaded but at that point I’m stuck. I’m not sure how to call functions inside the domains loaded assembly at will and so on.

Here is my loading setup so far, minus error checking and such:

ICorRuntimeHost* lpRuntimeHost = NULL;
CorBindToRuntimeEx( L"v4.0.30319", L"wks", 0, CLSID_CorRuntimeHost, IID_PPV_ARGS( &lpRuntimeHost ) );

lpRuntimeHost->Start();

// File data read from disk. 
// Dll file just CreateFile/ReadFile and insert into pluginFileData.
CComSafeArray<BYTE> pluginFileData;

IUnknown* lpUnknown = NULL;
lpRuntimeHost->CreateDomain( wstrPlugin.c_str(), NULL, &lpUnknown );

CComPtr<_AppDomain> appDomain = NULL;
lpUnknown->QueryInterface( &appDomain.p );

CComPtr<_Assembly> appAssembly = NULL;
hResult = appDomain->Load_3( pluginFileData, &appAssembly );

I have a class library that all plugins must reference and use in order to be considered a plugin. Which so far is nothing more than a base class to inherit:

namespace FrameworkAPI
{
    public class IFrameworkPlugin
    {
        public override bool Initialize(IntPtr interfaceObj)
        {
            return false;
        }
    }
}

And then an extension would reference that class library and use that as its base:

namespace ClassLibrary1
{
    public class Main : IFrameworkPlugin
    {
        public override bool Initialize(IntPtr interfaceObj)
        {
            // Return true to stay loaded.
            return true;
        }
    }
}

What I am stuck at is how to do a few things:

  • How can I obtain the main class but as the base to invoke methods in the base that allow the main class to still handle?
  • How can I ensure that the main class inherits the base so I can ensure its a valid plugin file?
  • How I can freely invoke methods from the C++ side to fire events in the C# plugin.

For the firing events, the C++ plugin will call more things in the C# plugins once they are loaded, such as rendering events, command handling, etc.

Most of the examples I find online are specific to requiring the entire C# side to be static which I don’t want. Also most do not use separate AppDomains and rather all execute in the default. I don’t want this since it limits being able to unload a specific plugin.

If any other info is missing and needed feel free to let me know.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:46:30+00:00Added an answer on June 14, 2026 at 7:46 pm

    I resolved this issue by using a COM exposed interface for the C# side of things.

    I have placed the FrameworkAPI inside a separate DLL and exposed it’s main interface to COM then reference it in the plugins that will use it.

    With it compiled with COM enabled, I can import the .tlb generated file to use the interface in C++ easily.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with a project that uses twitter-bootstrap-rails. This project was built on a
I'm working on a project that's a .NET extension to a rather large classic
I am working on a small Visual Studio extension that acts on projects in
I'm making extensive use of Markdown in a new project that I'm working on,
I'm working on an extension for Alfred that uses touch to create a new
I am working with an extension of the DefaultTableModel as follows: This is the
I'm working on an extension method that's only applicable to reference types. I think,
I'm working on a minimal Firefox extension that loads a web page into an
I am currently working on a Magento extension, and I have overridden a core
I am working on a project that requires a class QueueArray that is an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.