Fast-DDS icon indicating copy to clipboard operation
Fast-DDS copied to clipboard

Macros are not prefixed causing issues when trying to integrate FastDDS in large scale projects

Open deeplearningrobotics opened this issue 3 years ago • 1 comments

Is there an already existing issue for this?

  • [X] I have searched the existing issues

Expected behavior

All macros used are prefixed not causing any conflicts with existing code. ESPECIALLY macros in headers with public API.

Current behavior

Other code defines logError. Because the macro below is not prefix such as #define FastDDS_logError or something similar a compiler error occures.

external/fastrtps/fastdds/dds/log/Log.hpp:44:9: note: macro 'logError' defined here
#define logError(cat, msg) logError_(cat, msg)

Steps to reproduce

Just define some function called logError anywhere in your code.

Fast DDS version/commit

e6e7eac5a642f606fdaa40a0a2a16617ae9384da

Platform/Architecture

Ubuntu Focal 20.04 amd64

Transport layer

Default configuration, UDPv4 & SHM

Additional context

No response

XML configuration file

No response

Relevant log output

No response

Network traffic capture

No response

deeplearningrobotics avatar May 20 '22 04:05 deeplearningrobotics

Hi @deeplearningrobotics,

Thanks for your contribution! We are thinking about how to solve it. We cannot proceed as you suggest because it implies an API break and, as per Fast DDS versioning policy, this can only be done between major versions. We are considering allowing an API break by adding a CMake build option that disables the public macro definitions so the user with conflicting definitions can have a workaround by disabling Fast DDS public macros.

JLBuenoLopez avatar Jun 30 '22 06:06 JLBuenoLopez

I am going to close this issue as Fast DDS v2.9.0 included new log macros keeping the old ones for backwards compatibility. Fast DDS documentation explains how to disable the old macros.

JLBuenoLopez avatar Apr 11 '23 05:04 JLBuenoLopez