Skip to content
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

Add a macro for prefixing embedder.h symbols #9851

Merged
merged 4 commits into from
Jul 23, 2019

Conversation

stuartmorgan
Copy link
Contributor

embedder.h is a C API, so has no namespace, and only uses 'Flutter' as a
prefix for most symbol names. This creates potential collisions with
other code; for instance, FlutterEngine is the name of a type in
embedder.h, but also an ObjC class in the iOS Flutter API.

This adds a macro that can be set to prefix symbol names, allowing
clients (notably, the macOS embedding) to adjust the names used by the
embedding API internally without breaking ABI or API compatibility for
the standard engine build.

Currently the macro is only applied to FlutterEngine, since that's the
symbol that is currently at issue, but it can be expanded to other
symbols in the future.

embedder.h is a C API, so has no namespace, and only uses 'Flutter' as a
prefix for most symbol names. This creates potential collisions with
other code; for instance, FlutterEngine is the name of a type in
embedder.h, but also an ObjC class in the iOS Flutter API.

This adds a macro that can be set to prefix symbol names, allowing
clients (notably, the macOS embedding) to adjust the names used by the
embedding API internally without breaking ABI or API compatibility for
the standard engine build.

Currently the macro is only applied to FlutterEngine, since that's the
symbol that is currently at issue, but it can be expanded to other
symbols in the future.
shell/platform/common/cpp/BUILD.gn Show resolved Hide resolved
shell/platform/darwin/macos/framework/Source/FLEEngine.mm Outdated Show resolved Hide resolved
shell/platform/embedder/BUILD.gn Outdated Show resolved Hide resolved
]
# Template for the embedder build. Used to allow building it multiple times with
# different flags.
template("embedder_source_set") {
Copy link
Member

Choose a reason for hiding this comment

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

It may be better to create a template for the embedder dylib (i.e a template that expands to shared_library instead of source_set) that not only sets the macro to rename symbols but also adds a suffix to the dylib so that multiple dylib versions with renamed symbols may coexist in the out directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What's the use case for this? I don't expect us to ever need to build a prefixed dylib.

shell/platform/embedder/embedder.cc Outdated Show resolved Hide resolved
@stuartmorgan stuartmorgan merged commit 7d320c4 into flutter:master Jul 23, 2019
@stuartmorgan stuartmorgan deleted the embedder-prefix-macro branch July 23, 2019 12:48
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 23, 2019
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Jul 23, 2019
…9851) (#36762)

flutter/engine@1f30131...7d320c4

git log 1f30131..7d320c4 --no-merges --oneline
7d320c4 Add a macro for prefixing embedder.h symbols (flutter/engine#9851)

The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

If the roll is causing failures, please contact the current sheriff ([email protected]), and stop
the roller if necessary.
clarkezone added a commit to clarkezone/engine that referenced this pull request Jul 27, 2019
johnsonmh pushed a commit to johnsonmh/flutter that referenced this pull request Jul 30, 2019
…9851) (flutter#36762)

flutter/engine@1f30131...7d320c4

git log 1f30131..7d320c4 --no-merges --oneline
7d320c4 Add a macro for prefixing embedder.h symbols (flutter/engine#9851)

The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

If the roll is causing failures, please contact the current sheriff ([email protected]), and stop
the roller if necessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants