Skip to content

[Windows] dllexport support for ament_cmake #201

@seanyen

Description

@seanyen

On Windows, Microsoft C/C++ compiler comes with a concept of dllexport and dllimport. In order to make a DLL library header able to be consumed by the downstream project, the function, class, or data declaration needs to be decorated with the correct attributes.

CMake provides CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS and attempts to fix the problem less intrusive to the existing code base. However, it still comes with limitation, for example, it doesn't support static member, and it will bloat the size of the generated imported library because it exhaustively exposes whatever it can do.

In ROS1, I explored a way to enable dllexport and dllimport for a catkin-based project. Here is the pull request for rviz to show the example. This change makes use of generate_export_header and with some careful steps to stage and install it to a place to be consumed within and across catkin packages.

I would like to use this ticket to discuss:

  1. Any feedback on the generate_export_header approach?
  2. Would it make sense to make it part of ament_cmake requirements or should it be just step-by-step guidance in the ament_cmake User Documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions