https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99741

            Bug ID: 99741
           Summary: dllexport attribute is not compatible with c99 inline
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aladjev.andrew at gmail dot com
  Target Milestone: ---

Created attachment 50466
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50466&action=edit
fit.tar.gz

Hello, please review the following cmake issue here
https://gitlab.kitware.com/cmake/cmake/-/issues/21940#note_925715.

I am trying to create cross platform application, than I need to compile it
using MSVC. MSVC requires mandatory dllexport and dllimport attributes for all
functions including C99 inline functions. Clang is completely ignoring these
attributes in GNU env and it is always successful
https://github.com/llvm/llvm-project/commit/606bd6dcc547cf2f9fd7387321db79419bf60041.
GCC ignores only dllimport attribute, but fails with dllexport attribute.

Please review simplified project: a1.h, a1.c, a2.c and CMakeLists.txt attached.
You can try to build it on windows using:

CC="gcc" cmake -G "Unix Makefiles" -DCMAKE_VERBOSE_MAKEFILE=1 . && make
CC="clang" cmake -G "Unix Makefiles" -DCMAKE_VERBOSE_MAKEFILE=1 . && make

GCC provides error: multiple definition of func. I can't understand the reason
of this error: maybe dllexport converted C99 inline declaration into C89?

Workaround for this issue is to remove dllexport attribute for windows platform
+ gcc on makefile generator layer (cmake/etc).

PS this issue is indirectly related to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90161
  • [Bug c/99741] New: dllexport ... aladjev.andrew at gmail dot com via Gcc-bugs

Reply via email to