@@ -100,7 +100,7 @@ def generate_function_pointers(dll_file_path, header_file_path, output_h_path, o
100100 includes = re .findall (r"#include\s+<.*?>" , header_content )
101101
102102 # Find all typedefs, including their documentation comments
103- typedefs = re .findall (r"/\*\*(?:[\s\S]*?)\*/\s*typedef[\s\S]*?;\s*" , header_content )
103+ typedefs = re .findall (r"(?: /\*\*(?:[\s\S]*?)\*/\s*)? typedef[\s\S]*?;\s*" , header_content )
104104
105105 # --- Extract function prototypes ---
106106 function_pattern = re .compile (
@@ -127,7 +127,7 @@ def generate_function_pointers(dll_file_path, header_file_path, output_h_path, o
127127 if "void" in return_type :
128128 return_statement = " // No return value."
129129 elif "*" in return_type :
130- return_statement = f' return ({ return_type } )(&g_stub_memory);'
130+ return_statement = f' return ({ return_type } )(&g_stub_memory[0] );'
131131 else : # bool, int64_t, etc.
132132 return_statement = " return 1;"
133133
@@ -203,7 +203,8 @@ def generate_function_pointers(dll_file_path, header_file_path, output_h_path, o
203203 f .write (f"// Generated from { os .path .basename (header_file_path )} by { os .path .basename (sys .argv [0 ])} \n \n " )
204204 f .write (f'#include "{ INCLUDE_PREFIX } { os .path .basename (output_h_path )} "\n \n ' )
205205 f .write ('#include <stddef.h>\n \n ' )
206- f .write ("static void* g_stub_memory = NULL;\n \n " )
206+ f .write ("// A nice big chunk of stub memory that can be returned by stubbed Create methods.\n " )
207+ f .write ("static char g_stub_memory[256] = {0};\n \n " )
207208 f .write ("// clang-format off\n " )
208209 f .write (f'\n // Number of Google Analytics functions expected to be loaded from the DLL.' )
209210 f .write (f'\n const int FirebaseAnalytics_DynamicFunctionCount = { len (function_details_for_loader )} ;\n \n ' );
0 commit comments