[cfe-dev] Big Clang DLL, plug-in mechanism revision

John Thompson john.thompson.jtsoftware at gmail.com
Tue May 17 17:21:59 PDT 2011


Cédric,

I've integrated your changes and got the PrintFunctionNames plugin to work.
Thank you so much!

I've updated my posted patches.

The only problem left that I know about is the .inc file dependency problem.

-John

On Tue, May 17, 2011 at 1:17 PM, Cédric Venet <cedric.venet at laposte.net>wrote:

> Hi,
>
> Thanks for doing the hard work! I found how to make it works. There was a
> few problems:
>  * a bug in VS: http://support.microsoft.com/kb/127900
>  * exporting the templated classes was posing problem since they were not
> instanciated explicitly so do not export them
>  * only export the 4 static members
>
> I send you back your files, I added a test to verify that a class
> registered in the dll appeared in the exe. I have no patch since I changed
> the end lines :( (they were mixed linux/windows). however, the change are
> simple, remove all SUPPORT_LINKAGE from the registry.h then replace the
> lines:
>
>     friend class node;
>     static node *Head,*Tail;
>
>     friend class listener;
>     static listener *ListenerHead,*ListenerTail;
>
> by:
>
>     friend class node;
>     SUPPORT_LINKAGE static node *Head;
>     SUPPORT_LINKAGE static node *Tail;
>
>     friend class listener;
>     SUPPORT_LINKAGE static listener *ListenerHead;
>     SUPPORT_LINKAGE static listener *ListenerTail;
>
> you can also remove AST_LINKAGE from regexpdll.cpp
>
> hope this solve your problem!
>
> Cédric
>
> Le 17/05/2011 02:29, John Thompson a écrit :
>
> Cédric,
>
> There are still problems with the various forward and static declarations
> within the Registry class, even after adding the __declspec(dllexport)
> directive.
>
> I've extracted a small project for experimenting with this independently
> and enclosed it.  I'm using a .tar file because gmail wouldn't let me send a
> zip.
>
> I'd appreciate it if you could help me out with it.
>
> The solution in regexp builds a DLL and a program referencing it.
>
> Thanks.
>
> -John
>
> On Mon, May 16, 2011 at 1:11 PM, Cédric Venet <cedric.venet at laposte.net>wrote:
>
>>
>> Hi,
>>
>> I notice that you didn't export the class Registry? I think you only need
>> to add:
>>
>> template <typename T, typename U = RegistryTraits<T> >
>>   class SUPPORT_LINKAGE Registry {
>>   public:
>>
>> to make this work [1]. I was not able to use your patch on my system, so I
>> could not try my suggestion sorry. However if this does not solve your
>> problem, I can setup a small testcase. I only rarely used dll, but it seems
>> to me you exported some class which doesn't need to be (all inline
>> function)? I suppose it doesn't hurt except size and perhaps performance (
>> https://connect.microsoft.com/VisualStudio/feedback/details/633230/-declspec-dllexport-and-inline-functions-slow-compile-time)
>> so as a first approach it is not a problem.
>>
>> regards,
>> Cédric
>>
>> [1] from http://msdn.microsoft.com/en-us/library/81h27t8c(v=vs.80).aspx :
>> Because member functions and static data within a class implicitly have
>> external linkage, you can declare them with the *dllimport* or *dllexport*
>> attribute, unless the entire class is exported. If the entire class is
>> imported or exported, the explicit declaration of member functions and data
>> as *dllimport* or *dllexport*is prohibited. If you declare a static data
>> member within a class definition as *dllexport*, a definition must occur
>> somewhere within the same program (as with nonclass external linkage).
>>
>>
>


-- 
John Thompson
John.Thompson.JTSoftware at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110517/9cd30844/attachment.html>


More information about the cfe-dev mailing list