@@ -152,16 +152,15 @@ def generate_function_pointers(dll_file_path, header_file_path, output_h_path, o
152152 f .write ("\n \n " )
153153 f .write ("\n " .join (macro_definitions ))
154154 f .write ("\n // clang-format on\n " )
155+ f .write (f'\n // Number of Google Analytics functions expected to be loaded from the DLL.' )
156+ f .write ('\n extern const int FirebaseAnalytics_DynamicFunctionCount;\n ' );
155157 f .write ("\n // --- Dynamic Loader Declaration for Windows ---\n " )
156- f .write ("#if defined(_WIN32)\n " )
158+ f .write ("#if defined(_WIN32)\n \n " )
157159 f .write ('#include <windows.h>\n ' )
158- f .write (f'\n // Google Analytics Windows DLL SHA256 hash, to be verified on load.' )
159- f .write (f'\n extern const unsigned char FirebaseAnalytics_WindowsDllHash[{ len (dll_hash )} ];\n ' );
160-
161- f .write (f'\n // Number of Google Analytics functions expected to be loaded from the DLL.' )
162- f .write (f'\n #define FIREBASE_ANALYTICS_DYNAMIC_FUNCTION_COUNT { len (function_details_for_loader )} \n \n ' )
160+ f .write (f'\n // Google Analytics Windows DLL SHA256 hash, to be verified before loading.' )
161+ f .write (f'\n extern const unsigned char FirebaseAnalytics_WindowsDllHash[{ len (dll_hash )} ];\n \n ' );
163162 f .write ('// Load Analytics functions from the given DLL handle into function pointers.\n ' )
164- f .write (f'// Returns the number of functions successfully loaded (out of \n // FIREBASE_ANALYTICS_DYNAMIC_FUNCTION_COUNT) .\n ' )
163+ f .write (f'// Returns the number of functions successfully loaded.\n ' )
165164 f .write ("int FirebaseAnalytics_LoadDynamicFunctions(HMODULE dll_handle);\n \n " )
166165 f .write ('// Reset all function pointers back to stubs.\n ' )
167166 f .write ("void FirebaseAnalytics_UnloadDynamicFunctions(void);\n \n " )
@@ -180,12 +179,16 @@ def generate_function_pointers(dll_file_path, header_file_path, output_h_path, o
180179 f .write (f'#include "{ INCLUDE_PREFIX } { os .path .basename (output_h_path )} "\n \n ' )
181180 f .write ('#include <stddef.h>\n \n ' )
182181 f .write ("static void* g_stub_memory = NULL;\n \n " )
183- f .write ("// clang-format off\n \n " )
184- f .write ('// Google Analytics Windows DLL SHA256 hash, to be verified on load.\n ' )
182+ f .write ("// clang-format off\n " )
183+ f .write (f'\n // Number of Google Analytics functions expected to be loaded from the DLL.' )
184+ f .write (f'\n const int FirebaseAnalytics_DynamicFunctionCount = { len (function_details_for_loader )} ;\n \n ' );
185+ f .write ("#if defined(_WIN32)\n " )
186+ f .write ('// Google Analytics Windows DLL SHA256 hash, to be verified before loading.\n ' )
185187 f .write ('const unsigned char FirebaseAnalytics_WindowsDllHash[] = {\n ' )
186188 f .write (', ' .join (["0x%02x" % s for s in dll_hash ]))
187- f .write ('\n };\n \n ' )
188- f .write ("// --- Stub Function Definitions ---\n " )
189+ f .write ('\n };\n ' )
190+ f .write ("#endif // defined(_WIN32)\n " )
191+ f .write ("\n // --- Stub Function Definitions ---\n " )
189192 f .write ("\n \n " .join (stub_functions ))
190193 f .write ("\n \n \n // --- Function Pointer Initializations ---\n " )
191194 f .write ("\n " .join (pointer_initializations ))
0 commit comments