@@ -60,22 +60,21 @@ void Initialize(const App& app) {
6060
6161#if defined(_WIN32)
6262 if (!g_analytics_module) {
63- g_analytics_module = firebase::analytics::internal::VerifyAndLoadAnalyticsLibrary (
64- ANALYTICS_DLL_FILENAME,
65- FirebaseAnalytics_WindowsDllHash,
66- sizeof (FirebaseAnalytics_WindowsDllHash));
63+ g_analytics_module =
64+ firebase::analytics::internal::VerifyAndLoadAnalyticsLibrary (
65+ ANALYTICS_DLL_FILENAME, FirebaseAnalytics_WindowsDllHash,
66+ sizeof (FirebaseAnalytics_WindowsDllHash));
6767
6868 if (g_analytics_module) {
69- LogInfo (" Loaded Google Analytics module securely." );
70- int num_loaded = FirebaseAnalytics_LoadDynamicFunctions (g_analytics_module); // Ensure g_analytics_module is used
69+ LogInfo (" Loaded Google Analytics module." );
70+ int num_loaded = FirebaseAnalytics_LoadDynamicFunctions (
71+ g_analytics_module); // Ensure g_analytics_module is used
7172 if (num_loaded < FIREBASE_ANALYTICS_DYNAMIC_FUNCTION_COUNT) {
7273 LogWarning (
7374 " Only loaded %d out of %d expected functions from the Google "
7475 " Analytics module." ,
7576 num_loaded, FIREBASE_ANALYTICS_DYNAMIC_FUNCTION_COUNT);
7677 }
77- } else {
78- LogError (" Failed to load Google Analytics module securely. Operating in stub mode." );
7978 }
8079 }
8180#endif
@@ -92,21 +91,24 @@ bool IsInitialized() { return g_initialized; }
9291// Call this function when Analytics is no longer needed to free up resources.
9392void Terminate () {
9493#if defined(_WIN32)
95- // FirebaseAnalytics_UnloadDynamicFunctions(); // This should be called by the dynamic functions manager if needed
96- // or handled by the loaded module itself upon unload.
97- // If FirebaseAnalytics_UnloadDynamicFunctions clears function pointers,
98- // it's okay, but typically not called directly before FreeLibrary
99- // unless it's managing internal state that needs reset.
100- // For now, assuming FreeLibrary is sufficient for module cleanup.
94+ // FirebaseAnalytics_UnloadDynamicFunctions(); // This should be called by the
95+ // dynamic functions manager if needed or handled by the loaded module itself
96+ // upon unload. If FirebaseAnalytics_UnloadDynamicFunctions clears function
97+ // pointers, it's okay, but typically not called directly before FreeLibrary
98+ // unless it's managing internal state that needs reset.
99+ // For now, assuming FreeLibrary is sufficient for module cleanup.
101100 if (g_analytics_module) {
102- // Before freeing the library, ensure any dynamic functions are cleared if necessary,
103- // though FirebaseAnalytics_LoadDynamicFunctions is usually paired with an unload at a higher level
104- // or the dynamic function pointers are simply nulled out.
105- // FirebaseAnalytics_UnloadDynamicFunctions(); // Re-evaluating placement, typically called if functions are globally stored.
106- // If they are member of a class, destructor handles it.
107- // Given it's C-style, it might clear global pointers.
108- // This is generally okay to call before FreeLibrary.
109- FirebaseAnalytics_UnloadDynamicFunctions (); // Explicitly clear function pointers from dynamic loading.
101+ // Before freeing the library, ensure any dynamic functions are cleared if
102+ // necessary, though FirebaseAnalytics_LoadDynamicFunctions is usually
103+ // paired with an unload at a higher level or the dynamic function pointers
104+ // are simply nulled out. FirebaseAnalytics_UnloadDynamicFunctions(); //
105+ // Re-evaluating placement, typically called if functions are globally
106+ // stored. If they are member of a class, destructor handles it. Given it's
107+ // C-style, it might clear global pointers. This is generally okay to call
108+ // before FreeLibrary.
109+ FirebaseAnalytics_UnloadDynamicFunctions (); // Explicitly clear function
110+ // pointers from dynamic
111+ // loading.
110112 FreeLibrary (g_analytics_module);
111113 g_analytics_module = 0 ;
112114 }
0 commit comments