X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmingwdlltool.cpp;h=62ef7059a885d7a78d2dd216b2d2612c3eeabd42;hb=1ed833343bc83b83c5f61cbfd74423bbba677a04;hp=03babd4126e09df7ff8869f5da214807094fb530;hpb=e516e78510ad455eebc0e06645c9f12943117525;p=builder.git diff --git a/source/mingwdlltool.cpp b/source/mingwdlltool.cpp index 03babd4..62ef705 100644 --- a/source/mingwdlltool.cpp +++ b/source/mingwdlltool.cpp @@ -19,18 +19,19 @@ MingwDllTool::MingwDllTool(Builder &b, const Architecture &a): Tool(b, a, "DLL") { set_command("dlltool", true); + set_run(_run); } -Target *MingwDllTool::create_target(const list &sources, const string &) +Target *MingwDllTool::create_target(const vector &sources, const string &) { if(sources.size()!=1) throw invalid_argument("MingwDllTool::create_target"); SharedLibrary &shlib = dynamic_cast(*sources.front()); - list objs; - const Target::Dependencies &depends = shlib.get_dependencies(); - for(Target::Dependencies::const_iterator i=depends.begin(); i!=depends.end(); ++i) - if(ObjectFile *obj = dynamic_cast(*i)) + vector objs; + objs.reserve(shlib.get_dependencies().size()); + for(Target *d: shlib.get_dependencies()) + if(ObjectFile *obj = dynamic_cast(d)) objs.push_back(obj); ExportDefinitions *exp = new ExportDefinitions(builder, *shlib.get_component(), objs); @@ -57,8 +58,10 @@ Target *MingwDllTool::create_install(Target &target) const return 0; } -Task *MingwDllTool::run(const Target &target) const +Task *MingwDllTool::_run(const Target &target) { + const Tool &tool = *target.get_tool(); + const ImportLibrary *imp = dynamic_cast(&target); const ExportDefinitions *exp = 0; if(imp) @@ -69,7 +72,7 @@ Task *MingwDllTool::run(const Target &target) const throw invalid_argument("MingwDllTool::run"); vector argv; - argv.push_back(executable->get_path().str()); + argv.push_back(tool.get_executable()->get_path().str()); /* dlltool is stupid and puts temporary files in the working directory by default */ @@ -100,12 +103,9 @@ Task *MingwDllTool::run(const Target &target) const } else { - const Target::Dependencies &depends = exp->get_dependencies(); - for(Target::Dependencies::const_iterator i=depends.begin(); i!=depends.end(); ++i) - { - if(ObjectFile *obj = dynamic_cast(*i)) + for(Target *d: exp->get_dependencies()) + if(ObjectFile *obj = dynamic_cast(d)) argv.push_back(relative(obj->get_path(), work_dir).str()); - } // XXX Should use dllexport, but that has some other problems to solve argv.push_back("--export-all-symbols");