Skip to content

Fix linking libuuid on Windows #6460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2017
Merged

Fix linking libuuid on Windows #6460

merged 1 commit into from
Jan 10, 2017

Conversation

hughbe
Copy link
Contributor

@hughbe hughbe commented Dec 22, 2016

We use Windows SDKs to create UUID's (see #5949)

We have to link rpcrt4.lib to get these Win32 APIs - this is available on all Windows PCs.

Extracted from #5904

@compnerd
Copy link
Member

This is not globally available. The store partition does not permit it. Can we change the UUID generation to call ::CoCreateGuid instead of CreateUuid? That would link against Ole32.lib instead, and would be more portable across Windows families.

@hughbe
Copy link
Contributor Author

hughbe commented Dec 22, 2016

Hmm, according to the docs, CoCreatsGuid is a kind of wrapper of UUIDCreate:

The CoCreateGuid function calls the RPC function UuidCreate, which creates a GUID, a globally unique 128-bit integer. Use CoCreateGuid when you need an absolutely unique number that you will use as a persistent identifier in a distributed environment.To a very high degree of certainty, this function returns a unique value – no other invocation, on the same or any other system (networked or not), should return the same value.

@compnerd
Copy link
Member

Right :) It's merely about Microsoft blessing it for more broad usage.

@hughbe
Copy link
Contributor Author

hughbe commented Dec 23, 2016

Yeah, I was just investigating - I have pushed a change to use ole32.lib, and changed UUIDCreate to CoCreateGuid as you suggested. I've left everything renamed to uuid and used UUID instead of GUID, to simplify the diff. This doesn't matter, as <objbase.h> includes <rpc.h> so these definitions still exist. I think!

@compnerd
Copy link
Member

@swift-ci please test and merge

@slavapestov
Copy link
Contributor

@swift-ci Please smoke test

@slavapestov slavapestov self-assigned this Jan 9, 2017
@hughbe
Copy link
Contributor Author

hughbe commented Jan 9, 2017

@slavapestov I'm getting a 404 for one of the test runs: https://ci.swift.org/job/swift-PR-osx/4766/

Seems to be blocking the PR from merging

@slavapestov slavapestov merged commit 624073a into swiftlang:master Jan 10, 2017
@hughbe hughbe deleted the libuuid-windows branch January 10, 2017 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants