On Tue, 28 Oct 2003 14:00:46 +0100, stephan beal
<stephan@wanderinghorse.net> wrote:
[color=blue]
>Good afternoon, C++ers,
>
>(i hope this is not viewed as an advertisement or shameless plug, and i
>appologize if it is interpretted that way.)
>
>i have developed a template-based classloader which is capable of loading
>from DLLs (on Linux-ish systems, as i have little experience with other
>platforms, but the platform-specific code is limited to about 4 lines). i
>mention this not the world needs another classloader, but because i think
>the model and implementation might be interesting for class template fans,
>primarily for it's two main features:
>
>- compile-time type safety even for classes loaded via DLLs (i know nobody's
>gonna believe me on that ;).
>
>- NO casts are necessary, neither client-side nor in the core library.
>
>(Well, okay, and admittedly because it would tickle me pink if someone more
>well-versed in class templates than i would have a look at them. ;)
>
>The code is not structurally suitable for pasting into a usenet post, but
>the source tree is avaiable here:
>
>
http://s11n.net/class_loader/
>
>Caveat: it's only known to build with gcc 3.3x, and known to NOT work with
>gcc 2.x. YMMV with other compilers.
>
>(PS: how the no-casts-necessary-type-safety for DLLs is achieved is
>explained in the library manual, availabe in PDF/PS/HTML formats at the
>above link.)[/color]
A quick comment
static int register_factory( const KeyType & key, factory_type factory
= 0 );
could be (to avoid an implementation detail being in the interface):
static void register_factory( const KeyType & key, factory_type
factory = 0);
by using the comma operator at the registration site:
namespace
{
int global = (factory::register_factory(key), 0);
}
It looks nicely documented, but I haven't got a unix system to try it
out on...
Tom