<div dir="ltr"><div><span style="font-size:12.8px">Plugins for opt are expected to reference symbols defined in the main executable, rather than linking in another copy of LLVM libraries and globals.</span></div><div><br></div>LLVM and Clang were developed on Linux and Mac, where this is a common technique. On Windows, it is much harder to do this, although it is possible. Instead, it is much more common to move most of the application logic into a DLL and link plugins against that.<div><br></div><div>I think you can load passes into opt if you build LLVM as a DLL (cmake -DLLVM_BUILD_LLVM_DYLIB=ON), and link your pass against LLVM.dll. I've never attempted this personally, but it should work. :)</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Nov 1, 2015 at 11:53 PM, Markus Himmel via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal">Hi,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I have been playing around with a custom pass which is built out-of-source using CMake. It works as expected on Linux. I have also built the pass and llvm trunk (separately) using Visual Studio. However when running `opt –load=… -help` on Windows, the –load directive appears to work but the passes defined in the .dll are not displayed. In several places it is suggested that this is due to dynamic linking not being supported on Windows (e.g. [1]). However, I do not fully understand this explanation, since there does in fact appear to be Run-Time Dynamic Linking on Windows [2], and this is even implemented in lib/Support/Windows/DynamicLibrary.inc. I would greatly appreciate someone explaining in a little more detail why dynamic linking of loadable modules is not supported on Windows, or if it is and I’m just doing something wrong.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Thanks a lot,<u></u><u></u></p><p class="MsoNormal">Markus<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">[1] <a href="http://uu-kk.blogspot.de/2012/02/llvm-pass-on-windows-integrating-with.html" target="_blank">http://uu-kk.blogspot.de/2012/02/llvm-pass-on-windows-integrating-with.html</a> <u></u><u></u></p><p class="MsoNormal">[2] <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms685090(v=vs.85).aspx" target="_blank">https://msdn.microsoft.com/en-us/library/windows/desktop/ms685090(v=vs.85).aspx</a> <u></u><u></u></p></div></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>