Allow multiple USD in the same process on MacOS (#93) #2861
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change(s)
This PR allows loading multiple usd libraries into the same process on macos (assuming they are uniquely namespaced and plugins are loaded from different locations etc).
It's implemented by driving the ArchConstructorEntry's version field through a preprocessor define so that the logic for calling them can distinguish entries from the two different builds and only call the appropriate ones.
This is arguably a hack abusing the field for something it should not be used for but if we change the layout of the struct it will break cases where we don't have control of the other usd instance than the one we are building ourselves since the struct is at play in both usd builds.
Note, I don't necessarily want this PR merged in this form, I just want to point out an issue through a workaround we had to apply to solve an issue.
Fixes Issue(s)