<div>Cédric,</div>
<div> </div>
<div>I've updated my patches to include yours at:</div>
<div><br><a href="http://www.jtlanguage.com/xfer/dll_llvm_patch.txt">http://www.jtlanguage.com/xfer/dll_llvm_patch.txt</a><br><a href="http://www.jtlanguage.com/xfer/dll_clang_patch.txt">http://www.jtlanguage.com/xfer/dll_clang_patch.txt</a></div>
<div> </div>
<div>in case you want to play around with the whole thing.</div>
<div> </div>
<div>Note, to enable the DLL build, you need to run:</div>
<div> </div>
<div>cmake -G "Visual Studio 9 2008" -DCLANG_BUILD_EXAMPLES=ON -DLLVM_BUILD_DLL=ON .</div>
<div> </div>
<div>Note also that just as you normally do when changing the cmake configuration, you should probably delete the CMakeCache.txt file from the llvm root before running the above.<br></div>
<div>This update also has the Index tests fixed, such that all Clang tests passed for me. Turns out I needed to handle passing in the repository version needed by the precompilation.</div>
<div> </div>
<div>I still need to fix the .inc dependency problems in the build, though, which I'll do next.</div>
<div> </div>
<div>-John<br></div>
<div class="gmail_quote">On Mon, May 16, 2011 at 11:40 AM, John Thompson <span dir="ltr"><<a href="mailto:john.thompson.jtsoftware@gmail.com">john.thompson.jtsoftware@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>Thanks, Cedric.</div>
<div> </div>
<div>However, I still have the problem of how to export these members using the VC++ __declspec(dllexport) directive.</div>
<div> </div>
<div>For example, for simplicity, if I define AST_LINKAGE as follows:</div>
<div> </div>
<div>#define AST_LINKAGE __declspec(dllexport)</div>
<div> </div>
<div>I get the following compile results for the following permutations (showing just the first declaration of the quadruple as an example):</div>
<div> </div>
<div>1:</div>
<div>AST_LINKAGE template <><br>llvm::Registry<clang::PluginASTAction,llvm::RegistryTraits<clang::PluginASTAction> >::node*<br> llvm::Registry<clang::PluginASTAction,llvm::RegistryTraits<clang::PluginASTAction> >::Head;</div>
<div> </div>
<div>1>..\Frontend\FrontendAction.cpp(386) : warning C4091: '__declspec(dllexport)' : ignored on left of 'int' when no variable is declared<br>1>..\Frontend\FrontendAction.cpp(386) : error C2143: syntax error : missing ';' before ''template<''</div>
<div> </div>
<div>2:</div>
<div>template <><br>AST_LINKAGE llvm::Registry<clang::PluginASTAction,llvm::RegistryTraits<clang::PluginASTAction> >::node*<br> llvm::Registry<clang::PluginASTAction,llvm::RegistryTraits<clang::PluginASTAction> >::Head;</div>
<div> </div>
<div>1>..\Frontend\FrontendAction.cpp(388) : error C2370: 'Head' : redefinition; different storage class<br>1> D:\Clang\llvmdll\include\llvm/Support/Registry.h(76) : see declaration of 'Head'</div>
<div> </div>
<div>3:</div>
<div>template <><br>llvm::Registry<clang::PluginASTAction,llvm::RegistryTraits<clang::PluginASTAction> >::node*<br> AST_LINKAGE llvm::Registry<clang::PluginASTAction,llvm::RegistryTraits<clang::PluginASTAction> >::Head;</div>
<div> </div>
<div>1>..\Frontend\FrontendAction.cpp(388) : error C2059: syntax error : '__declspec(dllexport)'<br></div>
<div>It seems that #2 is the likely candidate, but it conflicts with the declaration of Head in the Registry class.</div>
<div> </div>
<div>Any ideas?</div>
<div> </div>
<div>Thanks.</div>
<div><br><font color="#888888">-John<br> </font></div>
<div>
<div></div>
<div class="h5">
<div class="gmail_quote">On Sat, May 14, 2011 at 2:19 AM, Cédric Venet <span dir="ltr"><<a href="mailto:cedric.venet@laposte.net" target="_blank">cedric.venet@laposte.net</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Le 11/05/2011 22:04, John Thompson a écrit :
<div><br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">I'm afraid I'm a bit template-dumb and don't know how to do those declarations. Every syntax combination I tried either didn't compile there, or elsewhere, the latter because the exported declarations would conflict with the "static node *Head, *Tail;" and "static listener *ListenerHead, *ListenerTail;" definitions inside the Registry template class. Can you give me an example?<br>
Template trickiness like this is why I felt a less sophisticated plug-in registry mechanism would be better. But if you can show me how to do it per your suggestion, I'll give it a try.<br><br></blockquote><br></div>
Here are patches for clang and llvm which should solve the registration problem. I tested them on win7 VS2010 without dll and the test are ok [1]. Turn out there was only 3 registries, so very small code change. On linux, there may be some more, I didn't check. Also these patch are not commit quality (line length, CRLF, comment/placement of the code). However, they should solve your problem. Let me know if you still have undefined or duplicated symbol when using your dll.<br>
<br>Thank you for tackling the dll problem on windows and hopping this make it into trunk sometime soon.<br><br>Cédric<br><br>[1] I have 3 llvm test failling and 1 clang test but it was before I made any change<br></blockquote>
</div><br></div></div></blockquote></div>