Fix indirect linkage to gIBaseFqName globals
Do not create a static variable in each sources. This
fix a linkage error for FQName(string) when libhidl-gen-utils
is not used directly, but FQName.h is included in sources.
Test: links
Change-Id: Ie154d7c6e07d4d1143d67b05aeaa85521836c0eb
diff --git a/utils/FQName.cpp b/utils/FQName.cpp
index 5aaa385..d457990 100644
--- a/utils/FQName.cpp
+++ b/utils/FQName.cpp
@@ -536,5 +536,8 @@
return ret;
}
+const FQName gIBaseFqName = FQName("android.hidl.base", "1.0", "IBase");
+const FQName gIManagerFqName = FQName("android.hidl.manager", "1.0", "IServiceManager");
+
} // namespace android
diff --git a/utils/include/hidl-util/FQName.h b/utils/include/hidl-util/FQName.h
index 17d25fc..14b0d62 100644
--- a/utils/include/hidl-util/FQName.h
+++ b/utils/include/hidl-util/FQName.h
@@ -242,8 +242,8 @@
void clearVersion();
};
-static const FQName gIBaseFqName = FQName("android.hidl.base", "1.0", "IBase");
-static const FQName gIManagerFqName = FQName("android.hidl.manager", "1.0", "IServiceManager");
+extern const FQName gIBaseFqName;
+extern const FQName gIManagerFqName;
} // namespace android