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 3599282
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:20:54+00:00 2026-05-18T20:20:54+00:00

In a c# assembly I’ve got a global prism CompositeCommand to subscribe to like

  • 0

In a c# assembly I’ve got a global prism CompositeCommand to subscribe to like this:

private static readonly CompositeCommand __myCommand = new CompositeCommand();

public static CompositeCommand MyCommand
{
  get { return _myCommand; }
}

From c# I can subscribe to this command using:

[...].MyCommand.RegisterCommand(new DelegateCommand<MyClass>((c) => c.Something()));

My problem: I need to subscribe to the command from managed c++, and I got no idea how the function signature needs to be to be used in DelegateCommand. Most of the time I get errors like:

error C2664: ‘Microsoft::Practices::Prism::Commands::DelegateCommand::DelegateCommand(System::Action ^)’: conversion of parameter 1 from ‘void (__clrcall *)(MyNameSpace::MyClass ^)’ in ‘System::Action ^’ not possible.

How do I subscribe to a c# command? Or is there some other way to listen to an event (I can replace the CompositeCommand with something different).

Thanks!

  • 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-05-18T20:20:55+00:00Added an answer on May 18, 2026 at 8:20 pm

    I’m going to assume that you’re using managed C++ – anything else, and there’s bigger issues to worry about.

    It looks like you’re getting linking errors to your C# type. As such, I don’t think the issue is related to any problems with Prism. In order for the C++ managed compiler to link to your C# assembly, you need to produce the C# assembly with an XML documentation file (see the Build tab in your properties). Is that enabled in your project?

    I used the following as a very simple proof of concept, where TestObject is defined in the C# assembly referenced by the C++ DLL. This compiled without any issues.

    Header file:

     void __clrcall CommandCallback(Project::Infrastructure::TestObject^ param);
    
    public ref class ManagedModule : IModule
    {
    public:
        ManagedModule();
    
         virtual void __clrcall Initialize();
    
    private:
    };
    

    Implementation:

    ManagedDLL::ManagedModule::ManagedModule()
    {
    
    }
    
    void __clrcall ManagedDLL::ManagedModule::Initialize()
    {
        Action<Project::Infrastructure::TestObject^>^ newAction = 
             gcnew Action<Project::Infrastructure::TestObject^>(&CommandCallback);
        DelegateCommand<Project::Infrastructure::TestObject^>^ newCommand = 
             gcnew DelegateCommand<Project::Infrastructure::TestObject^>(newAction);
        Project::Infrastructure::Commands::ApplicationExitCommand->RegisterCommand(newCommand);
    
        return;
    }
    
    void __clrcall CommandCallback(Project::Infrastructure::TestObject^ param)
    {
        return;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assembly.Location gives a plain path to the assembly. Unfortunately this is empty when running
I have a C# assembly containing an enum: public enum MyEnum { OK =
Assembly is a language I'd like to learn but still you don't hear often
[assembly: CLSCompliant(true)] //CS3016: Arrays as attribute arguments is not CLS-compliant. [ModuleExport(typeof(ModuleA), DependsOnModuleNames = new
I have an Assembly(A) which defines a Managed class which has a public constructor
Assembly.GetEntryAssembly() does not work for web applications. But... I really need something like that.
[assembly: AssemblyCopyright(Copyright © 2009)] is it possible somehow to access functions like DateTime.Now.Year inside
public Assembly LoadAssembly(string assemblyName) //@D://MyAssembly.dll { m_assembly = Assembly.LoadFrom(assemblyName); return m_assembly; } If I
I am learning assembly and I have this function that contains some lines I
I have a C# assembly that loads external files. This assembly is used by

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.