Mir

Code review comment for lp:~alan-griffiths/mir/fix-1615587

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

*If* we really don't like this (IMO perfectly reasonable) usage we could change the API/ABI design to be C compatible by adding a level of indirection. Vis:

struct GraphicsPlatformEntry
{
virtual mir::UniqueModulePtr<mir::graphics::Platform> create_host_platform(
    std::shared_ptr<mir::options::Option> const& options,
    std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,
    std::shared_ptr<mir::graphics::DisplayReport> const& report) = 0;
};

// This is the published entry point. NB Ownership is not transferred.
extern "C" GraphicsPlatformEntry* graphics_platform_entry;

// client code does:
  if (void* p = dlvsym(so, "graphics_platform_entry", version))
  {
      return static_cast<GraphicsPlatformEntry*>(p)
        ->create_stub_platform(the_options(), the_emergency_cleanup(), the_display_report());
  }

« Back to merge proposal