diff --git a/src/coff/coff_lib_writer.c b/src/coff/coff_lib_writer.c index 1aebcc69..6ad24044 100644 --- a/src/coff/coff_lib_writer.c +++ b/src/coff/coff_lib_writer.c @@ -128,9 +128,11 @@ coff_lib_writer_push_obj(COFF_LibWriter *writer, String8 obj_path, String8 obj_d } } -internal void +internal COFF_LibWriterSymbolNode * coff_lib_writer_push_export(COFF_LibWriter *writer, String8 raw_import_header) { + COFF_LibWriterSymbolNode *result = 0; + U64 member_idx = writer->member_list.count; COFF_ParsedArchiveImportHeader import_header = coff_archive_import_from_data(raw_import_header); @@ -145,33 +147,35 @@ coff_lib_writer_push_export(COFF_LibWriter *writer, String8 raw_import_header) COFF_LibWriterSymbol def_symbol = {0}; def_symbol.name = push_str8_copy(writer->arena, import_header.func_name); def_symbol.member_idx = member_idx; - coff_lib_writer_symbol_list_push(writer->arena, &writer->symbol_list, def_symbol); + result = coff_lib_writer_symbol_list_push(writer->arena, &writer->symbol_list, def_symbol); } break; case COFF_ImportHeader_Data: { COFF_LibWriterSymbol imp_symbol = {0}; imp_symbol.name = push_str8f(writer->arena, "__imp_%S", import_header.func_name); imp_symbol.member_idx = member_idx; - coff_lib_writer_symbol_list_push(writer->arena, &writer->symbol_list, imp_symbol); + result = coff_lib_writer_symbol_list_push(writer->arena, &writer->symbol_list, imp_symbol); } break; case COFF_ImportHeader_Const: { NotImplemented; } break; default: { InvalidPath; } break; } + + return result; } -internal void +internal COFF_LibWriterSymbolNode * coff_lib_writer_push_export_by_ordinal(COFF_LibWriter *lib_writer, COFF_MachineType machine, COFF_TimeStamp time_stamp, String8 dll_name, COFF_ImportType import_type, U16 ordinal) { String8 import_header = coff_make_import_header_by_ordinal(lib_writer->arena, machine, time_stamp, dll_name, ordinal, import_type); - coff_lib_writer_push_export(lib_writer, import_header); + return coff_lib_writer_push_export(lib_writer, import_header); } -internal void +internal COFF_LibWriterSymbolNode * coff_lib_writer_push_export_by_name(COFF_LibWriter *lib_writer, COFF_MachineType machine, COFF_TimeStamp time_stamp, String8 dll_name, COFF_ImportType import_type, String8 name, U16 hint) { String8 import_header = coff_make_import_header_by_name(lib_writer->arena, machine, time_stamp, dll_name, name, hint, import_type); - coff_lib_writer_push_export(lib_writer, import_header); + return coff_lib_writer_push_export(lib_writer, import_header); } internal String8List diff --git a/src/coff/coff_lib_writer.h b/src/coff/coff_lib_writer.h index 0e590ed3..0b2c166c 100644 --- a/src/coff/coff_lib_writer.h +++ b/src/coff/coff_lib_writer.h @@ -60,9 +60,9 @@ internal void coff_lib_writer_symbol_array_sort(COFF_LibWriterSymbol *arr, U64 c internal COFF_LibWriter * coff_lib_writer_alloc(void); internal void coff_lib_writer_release(COFF_LibWriter **writer_ptr); internal void coff_lib_writer_push_obj(COFF_LibWriter *writer, String8 obj_path, String8 obj_data); -internal void coff_lib_writer_push_export(COFF_LibWriter *writer, String8 raw_import_header); -internal void coff_lib_writer_push_export_by_ordinal(COFF_LibWriter *lib_writer, COFF_MachineType machine, COFF_TimeStamp time_stamp, String8 dll_name, COFF_ImportType import_type, U16 ordinal); -internal void coff_lib_writer_push_export_by_name(COFF_LibWriter *lib_writer, COFF_MachineType machine, COFF_TimeStamp time_stamp, String8 dll_name, COFF_ImportType import_type, String8 name, U16 hint); +internal COFF_LibWriterSymbolNode * coff_lib_writer_push_export(COFF_LibWriter *writer, String8 raw_import_header); +internal COFF_LibWriterSymbolNode * coff_lib_writer_push_export_by_ordinal(COFF_LibWriter *lib_writer, COFF_MachineType machine, COFF_TimeStamp time_stamp, String8 dll_name, COFF_ImportType import_type, U16 ordinal); +internal COFF_LibWriterSymbolNode * coff_lib_writer_push_export_by_name(COFF_LibWriter *lib_writer, COFF_MachineType machine, COFF_TimeStamp time_stamp, String8 dll_name, COFF_ImportType import_type, String8 name, U16 hint); internal String8List coff_lib_writer_serialize(Arena *arena, COFF_LibWriter *lib_writer, COFF_TimeStamp time_stamp, U16 mode, B32 emit_second_member); #endif // COFF_LIB_WRITER_H