Ejemplo n.º 1
0
/* resolve the imports for a Win32 module */
int resolve_imports( void )
{
    int i, j;

    if (nb_undef_symbols == -1) return 0; /* no symbol file specified */

    add_extra_undef_symbols();
    remove_ignored_symbols();

    for (i = 0; i < nb_imports; i++)
    {
        struct import *imp = dll_imports[i];

        for (j = 0; j < nb_undef_symbols; j++)
        {
            const char *res = find_symbol( undef_symbols[j], imp->exports, imp->nb_exports );
            if (res)
            {
                add_import_func( imp, res );
                free( undef_symbols[j] );
                undef_symbols[j] = NULL;
            }
        }
        /* remove all the holes in the undef symbols list */
        if (!remove_symbol_holes()) warn_unused( imp );
    }
    return 1;
}
Ejemplo n.º 2
0
/* resolve the imports for a Win32 module */
void resolve_imports( DLLSPEC *spec )
{
    int i;
    unsigned int j, removed;
    ORDDEF *odp;

    check_undefined_forwards( spec );

    for (i = 0; i < nb_imports; i++)
    {
        struct import *imp = dll_imports[i];

        for (j = removed = 0; j < undef_symbols.count; j++)
        {
            odp = find_export( undef_symbols.names[j], imp->exports, imp->nb_exports );
            if (odp)
            {
                if (odp->flags & FLAG_PRIVATE) continue;
                if (odp->type != TYPE_STDCALL && odp->type != TYPE_CDECL)
                    warning( "winebuild: Data export '%s' cannot be imported from %s\n",
                             odp->link_name, imp->spec->file_name );
                else
                {
                    add_import_func( imp, odp );
                    remove_name( &undef_symbols, j-- );
                    removed++;
                }
            }
        }
        if (!removed)
        {
            /* the dll is not used, get rid of it */
            if (check_unused( imp, spec ))
                warning( "winebuild: %s imported but no symbols used\n", imp->spec->file_name );
            remove_import_dll( i );
            i--;
        }
    }

    sort_names( &undef_symbols );
    check_undefined_exports( spec );
}