Skip to content

Fix flutter_windows_unittests linker warnings #109184

@cbracken

Description

@cbracken

When building flutter_windows_unittests.exe, we get the following linker warnings:

[5860/5960] LINK ./flutter_windows_unittests.exe
b'flutter_windows_unittests.flutter_windows_unittests.obj : warning LNK4217: locally defined symbol FlutterDesktopEngineCreate imported in function "private: virtual void __cdecl flutter::testing::FlutterWindowsTest_GetTextureRegistrar_Test::TestBody(void)" (?TestBody@FlutterWindowsTest_GetTextureRegistrar_Test@testing@flutter@@EEAAXXZ)\r\n'
b'flutter_windows_unittests.flutter_windows_unittests.obj : warning LNK4217: locally defined symbol FlutterDesktopEngineGetTextureRegistrar imported in function "private: virtual void __cdecl flutter::testing::FlutterWindowsTest_GetTextureRegistrar_Test::TestBody(void)" (?TestBody@FlutterWindowsTest_GetTextureRegistrar_Test@testing@flutter@@EEAAXXZ)\r\n'
b'flutter_windows_unittests.flutter_windows_unittests.obj : warning LNK4217: locally defined symbol FlutterDesktopEngineDestroy imported in function "private: virtual void __cdecl flutter::testing::FlutterWindowsTest_GetTextureRegistrar_Test::TestBody(void)" (?TestBody@FlutterWindowsTest_GetTextureRegistrar_Test@testing@flutter@@EEAAXXZ)\r\n'

I accidentally introduced these in flutter/engine#35106 where I landed a parameter type fix for the declaration of FlutterDesktopEngineGetTextureRegistrar in our public Windows C API. I also added a unit test that called this function.

That function (and all others) in our public Windows API is marked FLUTTER_EXPORT, which resolves to __declspec(dllexport) or __declspec(dllimport) depending on whether FLUTTER_DESKTOP_LIBRARY is defined. It can be defined by adding the following build config: //flutter/shell/platform/common:desktop_library_implementation

If the function is marked as an import, we get linker warnings that
we're importing a function that's defined in the same executable image. We should either define it as a no-op or as an export (which doesn't matter since it's just a unit tests) to fix the warnings.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: tests"flutter test", flutter_test, or one of our testsc: tech-debtTechnical debt, code quality, testing, etc.engineflutter/engine related. See also e: labels.platform-windowsBuilding on or for Windows specifically

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions