[cfe-dev] Big Clang DLL, plug-in mechanism revision
John Thompson
john.thompson.jtsoftware at gmail.com
Wed May 11 13:04:46 PDT 2011
Cedric,
Thanks for the reply.
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?
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.
-John
On Tue, May 10, 2011 at 5:17 AM, Cédric Venet <cedric.venet at laposte.net>wrote:
>
> Hi,
>
>
> 1. Plug-in registration. The current plug-in mechanism doesn't work on
>> Windows. Shared libraries work differently on Windows, such that building a
>> plug-in DLL on windows doesn't create a connection to the plug-in registry
>> in the libraries used in the Clang executable. The result is that in
>> running a plug-in like the PrintFunctionNames plug-in, there is no output
>> becase the plug-in is adding an entry to a registry that exists only in it's
>> own data space.
>> My solution for this was to dumb-down the registry a bit, and to have the
>> plug-in export a function to be called that creates and returns the plug-in
>> action object.
>>
>
> "fixing" the current implementation for dll is not to hard (I think) but
> need a little work. On would need to remove the following lines from the end
> of llvm/include/llvm/Support/Registry.h
>
> ==========
> // Since these are defined in a header file, plugins must be sure to
> export
> // these symbols.
>
> template <typename T, typename U>
> typename Registry<T,U>::node *Registry<T,U>::Head;
>
> template <typename T, typename U>
> typename Registry<T,U>::node *Registry<T,U>::Tail;
>
> template <typename T, typename U>
> typename Registry<T,U>::listener *Registry<T,U>::ListenerHead;
>
> template <typename T, typename U>
> typename Registry<T,U>::listener *Registry<T,U>::ListenerTail;
> ==========
>
> and instead to instanciate them in a cpp file (or multiple file) for each
> combination of T and U used. Those files would be part of the big DLL.
> I don't know how many registry exist in llvm, but probably not that much.
> Also, adding a registry is a rare occurence. greping the files for Registry
> should show the needed instanciation.
>
> Regards,
> Cédric
>
--
John Thompson
John.Thompson.JTSoftware at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110511/866aa163/attachment.html>
More information about the cfe-dev
mailing list