Boost logo

Boost :

Subject: Re: [boost] Any interest in static plugins?
From: Christian Schladetsch (christian.schladetsch_at_[hidden])
Date: 2009-12-03 21:14:07


Hi Dave,

On Fri, Dec 4, 2009 at 7:17 AM, Dave van Soest <dsoest_at_[hidden]> wrote:

> Hi Christian, Robert, others interested,
>
> Thanks for sharing your thoughts in this discussion. I'll try to summarize
> your posts in this way: you both don't think it is possible to create this
> static plugin functionality using static initialization and get it working
> on every supported platform.
>

Actually, what I said was:

Sure, you can come up with and practically use toy systems with a given
> linker in a given configuration that have no problem. But when you have
> complex and.or derived types, or use dynamic linking, it becomes an
> intractable problem.
>

The problem here is that it is just a bad idea to use statics and type
factories in this way. There will be problem after problem. What are these
problems? The first problem is that of non-deterministic ordering of
initialisers. The second problem is that you're doing work and calling
functions before main(). The third problem are all the unknown problems that
will arise by using this approach.

This approach has been tried many times before. AFAICT, it has never ended
well. It requires bad practise (singletons, globals). It is untestable. It
doesn't work well with DLL's. If you use it in a threaded application, there
will be problems because of the globals. It doesn't scale to use types that
have other type components, or derive from other types.

Yes, it can work in a simple, limited case. But because of the scaling
problems, it is inadvisable to do this. I think that perhaps everyone has to
try to do this once, before they realise that it is a bad idea ;)

I could well be wrong, and I don't think I will dissuade you from continuing
your work on this. Best of luck.

Best,
Christian.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk