<div dir="ltr"><div>Hard to say. Personally, I've never used dependency walker (depends.exe?), and I'd approach the problem with dumpbin /imports and dumpbin /dependents. I'd start at the bottom of the dependency graph, gather the lists of imports, and look for major differences. One thing we've noticed in the past is that the order of DLLs in /dependents matters for reasons like these.</div><div><br></div><div>Regarding the std::allocator<char> constructor, I think that's expected. Both DLLs are supposed to instantiate the allocator template, and there should be two templates. They aren't supposed to import from each other, and everything should be fine.</div><div></div><div><br><div class="gmail_quote"><div dir="ltr">On Sat, Nov 24, 2018 at 11:28 PM JVApen via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hello <span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">all,</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">I'm working towards converting an MSVC application to compile and run with Clang-cl.</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">Over the last years, we've make a lot of progress on this.</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">Today however, I'm facing a problem I don't understand and hope that you will be able to help me with this.</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">When I build a single application from a monolithic code base, the executable works. (Thanks a lot for all of the effort to allow this!)<br></span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">However, if I build all of the executables (and extra dlls), the executable crashes.</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">>From what I can tell, the problem is the following:</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"> - Exe starts</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"> - Dll_A gets loaded</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"> - Dll_A has a dependency on Dll_B</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"> - Dll_B gets loaded</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"> - Dll_B depends on Dll_A => Circular dependency</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">However, when building a single executable, Dll_B was not build and Dll_A doesn't seem to depend on on Dll_B.</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">I've looked through this with dependency walker and found 2 reasons why Dll_A depends on Dll_B:</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">Following code exists in the code of Dll_A<br></span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">class I { virtual I *clone() const = 0; }</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">
</span><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">class EXPORT Impl { virtual Impl *clone() const { return new Impl{*this}; }</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">Dependency walker indicates that Dll_A contains:</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"> Impl *Impl::clone() const</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">It also indicates that Dll_B contains:</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"> I *Impl::clone() const</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">This last is a bit unexpected to me, however, covariance is not my expertise.</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">I've updated the code to not use covariance just to test.<br></span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">This again causes a circular dependency, because now a Dll_C (and depends on Dll_B) contains following symbol where Dll_A depends on:</span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"> std::allocator<char>::allocator<char>(std::allocator<char> const &)<br></span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">I wouldn't even know how to update the MSVC STL, nor would I want to do so as this is an external library.<br></span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></span></div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">Do you have any idea on what is causing this and how to get started on creating a reproduction for this? (And no, I unfortunately can't use CReduce)<br></span></div>
</div><div><span class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"></span><br clear="all"></div><div><div><div dir="ltr" class="m_5804232804650987989gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><font face="verdana, sans-serif">JVApen</font></div></div></div></div></div></div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div></div>