This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Fix libc++experimental build on Windows
AcceptedPublic

Authored by hamzasood on Sep 1 2017, 2:59 AM.

Details

Summary

This patch fixes a few problems with building libc++experimental on Windows.

Previously _LIBCPP_BUILDING_LIBRARY was defined for every source file, including files destined for the experimental library. As a result of this, non-experimental APIs were marked as dllexport when compiling the experimental library (which led to link errors whenever experimental code uses symbols from the regular libc++ library).
I've changed it so that _LIBCPP_BUILDING_LIBRARY is only defined for non-experimental source files, and _LIBCPPX_BUILDING_LIBRARY is defined for experimental source files (that macro isn't currently used for anything, it's mainly there for consistency).

I've also added the needed MSVCRT defines to the experimental code too, so that there won't be a bunch of warnings about using "deprecated" functions etc.

Diff Detail

Event Timeline

hamzasood created this revision.Sep 1 2017, 2:59 AM
compnerd requested changes to this revision.Sep 11 2017, 9:06 AM
compnerd added inline comments.
lib/CMakeLists.txt
189

Please use function rather than macro. There is no need to pollute the namespace here.

This revision now requires changes to proceed.Sep 11 2017, 9:06 AM
hamzasood updated this revision to Diff 114784.Sep 12 2017, 2:16 AM
hamzasood edited edge metadata.

Changed a CMake macro to a function.

compnerd accepted this revision.Oct 27 2017, 9:48 AM
This revision is now accepted and ready to land.Oct 27 2017, 9:48 AM