Skip to content

links misbehaves with object files ... #8

@assarbad

Description

@assarbad

The links function blindly appends .lib to the dependencies when the action is one of the vs* values. Unfortunately this collides with the desire to sometimes link to object files provided directly by Microsoft. Examples are thrownew.obj (and nothrownew.obj), hotpatch.obj, pnoarg.obj and setargv.obj (setargv.obj etc). The latter is useful to link POSIX utilities which expect the command line arguments to already be expanded, whereas on Windows the application itself is usually expected to handle wild cards.

As a side-note, my fix to the issue is this one (pure Lua):

    -- Fix up premake.getlinks() to not do stupid stuff with object files we pass
    local orig_premake_getlinks = premake.getlinks
    premake.getlinks = function(cfg, kind, part)
        local origret = orig_premake_getlinks(cfg, kind, part)
        local ret = {}
        for k,v in ipairs(origret) do
            local dep = v:gsub(".obj.lib", ".obj")
            dep = dep:gsub(".lib.lib", ".lib")
            table.insert(ret, dep)
        end
        return ret
    end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions