ImagingDataCommons / libdicom

C library for reading DICOM files
https://libdicom.readthedocs.io
MIT License
16 stars 8 forks source link

Only use `__attribute__((constructor))` if supported #66

Closed bgilbert closed 1 year ago

bgilbert commented 1 year ago

The HAS_CONSTRUCTOR check didn't do anything, since we tried to use __attribute__((constructor)) whether it was defined or not. That caused a build failure on MSVC.

Also, we shouldn't add the constructor attribute from a public header, since it's only relevant while building the library, and is conditioned on a config.h macro that isn't visible outside the library. Move constructor handling directly to the one call site that needs it.

While we're here, simplify the constructor support check in meson.build.