Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Comments

I supported clang-cl with BUILD_SHARED_LIBS#465

Merged
shinh merged 2 commits intogoogle:masterfrom
durswd:support_clang-cl
Sep 3, 2019
Merged

I supported clang-cl with BUILD_SHARED_LIBS#465
shinh merged 2 commits intogoogle:masterfrom
durswd:support_clang-cl

Conversation

@durswd
Copy link
Contributor

@durswd durswd commented Sep 2, 2019

clang-cl (clang for msvc) can compiles static void foo(void) __attribute__ ((visibility(\"default\")));
But functions are not exported as DLL functions.
So these errors are caused.

undefined symbol: "void __cdecl google::ShutdownGoogleLogging(void)" (?ShutdownGoogleLogging@google@@YAXXZ)	logging_unittest	D:\Dev\glog\build_\lld-link	1	
undefined symbol: "void __cdecl google::RawLog__(int, char const *, int, char const *)" (?RawLog__@google@@YAXHPBDH0ZZ)	logging_unittest	D:\Dev\glog\build_\lld-link	1	
undefined symbol: "void __cdecl google::InstallFailureWriter(void (__cdecl *)(char const *, int))" (?InstallFailureWriter@google@@YAXP6AXPBDH@Z@Z)	signalhandler_unittest	D:\Dev\glog\build_\lld-link	1	

I made HAVE___ATTRIBUTE__VISIBILITY_DEFAULT disabled on MSVC.

@googlebot
Copy link
Collaborator

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@durswd
Copy link
Contributor Author

durswd commented Sep 2, 2019

@googlebot I signed it!

@googlebot
Copy link
Collaborator

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes and removed cla: no labels Sep 2, 2019
CMakeLists.txt Outdated
target_compile_definitions (glog PRIVATE GOOGLE_GLOG_IS_A_DLL=1)

if (HAVE___ATTRIBUTE__VISIBILITY_DEFAULT)
if (HAVE___ATTRIBUTE__VISIBILITY_DEFAULT AND NOT MSVC)
Copy link
Contributor

@shinh shinh Sep 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are trying to avoid using vendor names explicitly. Maybe better to change the order of conditions?

if (HAVE___DECLSPEC)
 set (_EXPORT "__declspec(dllexport)")
 set (_IMPORT "__declspec(dllimport)")
elseif (HAVE___ATTRIBUTE__VISIBILITY_DEFAULT)
  ...
endif(HAVE___DECLSPEC)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your suggestion. I changed it.

Copy link
Contributor

@shinh shinh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! We could create a follow-up patch if Sergiu (the owner of cmake build) or others have any comments.

@shinh shinh merged commit 4cc89c9 into google:master Sep 3, 2019
@sergiud sergiud added this to the 0.5 milestone Mar 30, 2021
@sergiud sergiud mentioned this pull request May 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants