/* free an import structure */ static void free_imports( struct import *imp ) { free( imp->exports ); free( imp->imports ); free_dll_spec( imp->spec ); free( imp->full_name ); free( imp ); }
/******************************************************************* * output_spec16_file * * Output the complete data for a spec 16-bit file. */ void output_spec16_file( DLLSPEC *spec16 ) { DLLSPEC *spec32 = alloc_dll_spec(); resolve_imports( spec16 ); add_16bit_exports( spec32, spec16 ); output_standard_file_header(); output_module( spec32 ); output_module16( spec16 ); output_stubs( spec16 ); output_exports( spec32 ); output_imports( spec16 ); if (is_undefined( "__wine_call_from_16" )) output_asm_relays16(); if (spec16->main_module) { output( "\n\t%s\n", get_asm_string_section() ); output( ".L__wine_spec_main_module:\n" ); output( "\t%s \"%s\"\n", get_asm_string_keyword(), spec16->main_module ); } output_gnu_stack_note(); free_dll_spec( spec32 ); output("%s:/*?*/\n", asm_name("_end")); }
/******************************************************************* * output_def_file * * Build a Win32 def file from a spec file. */ void output_def_file( DLLSPEC *spec, int include_private ) { DLLSPEC *spec32 = NULL; const char *name; int i, total; if (spec->type == SPEC_WIN16) { spec32 = alloc_dll_spec(); add_16bit_exports( spec32, spec ); spec = spec32; } if (spec_file_name) output( "; File generated automatically from %s; do not edit!\n\n", spec_file_name ); else output( "; File generated automatically; do not edit!\n\n" ); output( "LIBRARY %s\n\n", spec->file_name); output( "EXPORTS\n"); /* Output the exports and relay entry points */ for (i = total = 0; i < spec->nb_entry_points; i++) { const ORDDEF *odp = &spec->entry_points[i]; int is_data = 0; if (!odp) continue; if (odp->name) name = odp->name; else if (odp->export_name) name = odp->export_name; else continue; if (!(odp->flags & FLAG_PRIVATE)) total++; else if (!include_private) continue; if (odp->type == TYPE_STUB) continue; output( " %s", name ); switch(odp->type) { case TYPE_EXTERN: is_data = 1; /* fall through */ case TYPE_VARARGS: case TYPE_CDECL: case TYPE_THISCALL: /* try to reduce output */ if(strcmp(name, odp->link_name) || (odp->flags & FLAG_FORWARD)) output( "=%s", odp->link_name ); break; case TYPE_STDCALL: { int at_param = get_args_size( odp ); if (!kill_at && target_cpu == CPU_x86) output( "@%d", at_param ); if (odp->flags & FLAG_FORWARD) { output( "=%s", odp->link_name ); } else if (strcmp(name, odp->link_name)) /* try to reduce output */ { output( "=%s", odp->link_name ); if (!kill_at && target_cpu == CPU_x86) output( "@%d", at_param ); } break; } default: assert(0); } output( " @%d", odp->ordinal ); if (!odp->name || (odp->flags & FLAG_ORDINAL)) output( " NONAME" ); if (is_data) output( " DATA" ); if (odp->flags & FLAG_PRIVATE) output( " PRIVATE" ); output( "\n" ); } if (!total) warning( "%s: Import library doesn't export anything\n", spec->file_name ); if (spec32) free_dll_spec( spec32 ); }