From e99fc91c585d5a5a6ec9e9196874f18b69254a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 6 Jun 2013 13:26:42 +0200 Subject: iOS: Remove need for -force_load of platform plugin Instead of force-loading the whole static library of the platform plugin we tell the linker to look for the missing symbol qt_registerPlatformPlugin. This symbol is provided by the same object file as the plugin's static initializer, so the object file is included in the final binary and the static initializer is run, resulting in the plugin registering with Qt. We could have marked the actual static initializer wrapper provided by Q_IMPORT_PLUGIN(QIOSIntegrationPlugin) as undefined, but due to the C++ mangling this would look less intuitive on the linker command line than the custom dummy function that we provide, which has C linkage. Change-Id: I6805537e1f49260a41d48c555376964cb1fe75d8 Reviewed-by: Oswald Buddenhagen Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/plugin.mm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/ios/plugin.mm b/src/plugins/platforms/ios/plugin.mm index a93b6037ad..ca8ec936ae 100644 --- a/src/plugins/platforms/ios/plugin.mm +++ b/src/plugins/platforms/ios/plugin.mm @@ -66,4 +66,8 @@ QT_END_NAMESPACE #include "plugin.moc" +// Dummy function that we explicitly tell the linker to look for, +// so that the plugin's static initializer is included and run. +extern "C" void qt_registerPlatformPlugin() {} + Q_IMPORT_PLUGIN(QIOSIntegrationPlugin) -- cgit v1.2.3