<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black; background-color: white;">
<span style="margin: 0px; font-size: 11pt">Good Afternoon All,</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black; background-color: white;">
<br>
</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black; background-color: white;">
<span style="margin: 0px; font-size: 11pt">Thank you very much for all of your help. A combination of these suggestions got it working for me.</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black; background-color: white;">
<span style="margin: 0px; font-size: 11pt">For future reference:</span><br>
<span style="margin: 0px; font-size: 11pt; background-color: white;">Pass -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON</span><br>
</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black; background-color: white;">
<span style="margin: 0px; font-size: 11pt; background-color: white;">Run the clang.exe binary, but pass "--driver-mode=cl" to it so that it took clang-cl style flags. This was because clang-cl wouldn't work with the plugin.</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black; background-color: white;">
<span style="margin: 0px; font-size: 14.67px; background-color: white;"><br>
</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black; background-color: white;">
<span style="margin: 0px; font-size: 11pt; background-color: white;">This was a summer internship for me, so this email address will become inactive. If anyone is trying to do anything similar in the future, my boss can be contacted at </span><span style="margin: 0px; font-size: 11pt; background-color: white;">tor.klingberg@starleaf.com
 and is happy to answer questions.</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black; background-color: white;">
<span style="margin: 0px; font-size: 14.67px; background-color: white;"><br>
</span></div>
<div style="margin: 0px; font-size: 15px; font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; color: black; background-color: white;">
<span style="margin: 0px; font-size: 11pt">Kind Regards</span></div>
<div style="margin: 0px; font-size: 15px; font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; color: black; background-color: white;">
<span style="margin: 0px; font-size: 14.67px"><br>
</span></div>
<div style="margin: 0px; font-size: 15px; font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; color: black; background-color: white;">
<span style="margin: 0px; font-size: 11pt">Chris Baish</span></div>
<br>
</div>
<div id="appendonsend"></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size: 11pt;" data-ogsc=""><b>From:</b> Stephan Bergmann <sbergman@redhat.com><br>
<b>Sent:</b> 30 September 2019 14:12<br>
<b>To:</b> cfe-dev@lists.llvm.org <cfe-dev@lists.llvm.org><br>
<b>Cc:</b> Christopher Baish <christopher.baish@starleaf.com><br>
<b>Subject:</b> Re: [cfe-dev] Clang Plugins on Windows</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">On 30/09/2019 14:40, Christopher Baish via cfe-dev wrote:<br>
> I have written a plugin for Clang which does additional type checking <br>
> around format strings. It is currently running as a plugin on Linux and <br>
> macOS machines.<br>
> We are hoping to also run it on our Windows builds, in order to boost <br>
> our coverage, however I understand that the 'normal' way to use a clang <br>
> plugin doesn't work on Windows.<br>
> <br>
> The plugin currently works via a RecursiveASTVisitor, and then having <br>
> found an instance of a var-args function call runs the custom type checker.<br>
> <br>
> This <br>
> (<a href="https://stackoverflow.com/questions/25657586/how-to-enable-dll-building-for-windows-in-llvm" style="">https://stackoverflow.com/questions/25657586/how-to-enable-dll-building-for-windows-in-llvm</a>)
<br>
> implies that it would be possible to alter something in the build system <br>
> to compile in the plugin library statically. This would be ideal for our <br>
> use case, because we are building clang from source already, and we are <br>
> only using it with the plugin, never alone.<br>
> Unfortunately I can't find any information on how to go about statically <br>
> linking the library into the main executable, or about other ways we <br>
> could go about getting this working.<br>
<br>
We're using such a dynamic library plugin for LibreOffice.  I can't <br>
remember all the details of how I got it working on Windows, but what <br>
probably is relevant is building LLVM/Clang with <br>
-DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON and maybe some of the options we <br>
pass to cl.exe (aka $(COMPILER_PLUGINS_CXX) in our makefile) when <br>
linking the plugin DLL at <br>
<<a href="https://opengrok.libreoffice.org/xref/core/compilerplugins/Makefile-clang.mk?r=db123aba#202" style="">https://opengrok.libreoffice.org/xref/core/compilerplugins/Makefile-clang.mk?r=db123aba#202</a>>.
<br>
  Maybe that helps a bit...<br>
<br>
</div>
</span></font></div>
</body>
</html>