diff options
Diffstat (limited to 'project2/ice/iceCompile.cpp')
-rw-r--r-- | project2/ice/iceCompile.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/project2/ice/iceCompile.cpp b/project2/ice/iceCompile.cpp index 74b0b45..fc7e100 100644 --- a/project2/ice/iceCompile.cpp +++ b/project2/ice/iceCompile.cpp @@ -106,18 +106,26 @@ void IceCompile::Link(const fs::path & in, const fs::path & out) const { auto link = stringbf("%s %s -o %s -shared %s", linker, linkeropts, out, in); - BOOST_FOREACH(const auto & dep, deps) { - link += " " + (tmpdir / dep->OutputName(".so")).string(); - } Logger()->messagebf(LOG_DEBUG, "link command: %s", link); if (system(link.c_str())) { throw std::runtime_error("link failed"); } } -IceCompile::LibHandle +IceCompile::LibHandles IceCompile::Open() const { + LibHandles rtn; + BOOST_FOREACH(const auto & dep, deps) { + rtn.insert(dep->OpenLib()); + } + rtn.insert(OpenLib()); + return rtn; +} + +IceCompile::LibHandle +IceCompile::OpenLib() const +{ void * handle = dlopen((IceCompile::tmpdir / OutputName(".so")).string().c_str(), RTLD_GLOBAL | RTLD_NOW); if (!handle) { std::string msg(dlerror()); |