locked
Export a subclass of CWinFormsView from MFC extension dll

    Question


  • I'm using CWinFormsView to use a .Net control in an MFC application.

    This works OK.

    I have some application specific initialization, so I made a subclass of CWinFormsView with the same parameters in the constructor:

    CWinFormsView(System::Type^ pManagedViewType);

    This works when this class is in the same dll as it is used in.

    I want to move this code to a common dll, so that it can be used from different dlls in the application.

    Then the problems start. I get the following error message:

    __declspec(dllexport) cannot be applied to a function with the __clrcall calling convention

    How can I then make this class visible to other dlls?

    It must be possible, I'm only trying to do what Microsoft already does itself, export a native class with a managed parameter in the constructor.

    Has anybody any ideas on how to do that?

    Friday, May 11, 2012 12:20 PM

Answers