Unidata / UDUNITS-2

API and utility for arithmetic manipulation of units of physical quantities
http://www.unidata.ucar.edu/software/udunits
Other
62 stars 36 forks source link

This pull request fixes a name clash. When building on Windows both UDUnits and HDF5 create their own c99_snprintf functions. When linking statically this causes a name clash and link errors. #31

Closed philrosenberg closed 5 years ago

jbuonagurio commented 5 years ago

I had the same issue with the latest tag release (2.2.27.6). MSVC includes snprintf since 2015, so as long as you are working with a newer version it can be resolved with an #ifdef to exclude the udunits replacement functions. Slightly less intrusive. See the following commit:

jbuonagurio/UDUNITS-2@181fcedc9a7c4f8941a33bd8c578b86b8041ca56

semmerson commented 5 years ago

@jbuonagurio What happens if the MSVC version is less than 1900 and linking includes HDF5?

jbuonagurio commented 5 years ago

@semmerson in that case the functions would still have to be renamed as in the original PR to avoid multiple definitions.

semmerson commented 5 years ago

I went with @philrosenberg's solution rather than @jbuonagurio's because, although it's more intrusive, it's more robust. It will be in the next release.

@philrosenberg You need to sign the Contributor License Agreement so that I can simply merge your pull requests. Also, thanks for catching the error in the ut_is_dimensionless() documentation.