Shared objects?

Wouter Verhelst wouter at grep.be
Mon Jun 18 07:56:14 PDT 2012


Hi group,

I've been reading up on D for the past few days--something I'd been
planning to do for quite a while--and find much to like and little to
dislike; as such, I am considering using it for my next project, which
would run on Linux (and possibly some other POSIX systems) and would
need to load plugins.

Now I've done such things in C in the past, and it's not too difficult:
you create a .so file, have it call some initial function right after
the dlopen(), and then have that initial function register the new
functionality available.

After looking at the documentation for a few days, I've come to the
conclusion that with Object.factory and interfaces, I believe I can
abstract things enough so that all a plugin would need to do is register
a new class, which could then be instantiated if needs be. However, what
I don't find is the answer to the two following questions:

- Does D support dlopen(), or some similar mechanism, to allow me to
  load plugins at runtime?
- If it does, does Object.factory() still work for new classes loaded in
  through dlopen() (or its functional equivalence)?

Thanks,

-- 
The volume of a pizza of thickness a and radius z can be described by
the following formula:

pi zz a


More information about the Digitalmars-d mailing list