28, Richard schreef:
[Please do not mail me a copy of your followup]
Goran<
[email protected]> spake the secret code
<46010469-4b5a-4c7c-bc88-f202f3df0841@q13g2000vbd.googlegroups.com> thusly:
[...] There's COM on Windows and that's about it.
I believe the unix equivalent is CORBA.
More like the cross-platform equivalent; CORBA implantations are
available for other platforms as well (including Windows). There also
many other middleware solutions.
Although at that point, you might find yourself saying "maybe a plain
C interface to the loadable part isn't such a bad idea after all" ...
Either I am missing something huge, or what are you talking about?
I'm saying that if your problem is the one in the original posting
(calling code in dlopen()ed libraries) you'd probably rather stick to
a C interface than go CORBA, or XMLsomething, or ...
I misaddressed my post, I think Goran started talking about
COM as if dlopen limited anybody to C:
He who needs something more than that, C, should reach for
some integration tech that defines needed binary-level compatibility.
I find it amazing that virtually no such tech, that is cross-platform
and in wide use, exist today. There's COM on Windows and that's about
it.
So maybe LoadLibrary on Windows limits usage to C and one needs COM,
I don't know if that is true or not. Yeah, platforms do differ.
(Perhaps the topic shifted without me noticing it, because I can't see
how CORBA solves that at all.)
CORBA has a lot of features like load balancing, entities and so on;
using CORBA for a plugin framework is 'a bit of' an overkill. I see
no point in using CORBA on a single machine at all, I see the
major downside of using anything that is so heavy for simple
method calls, mainly because of PITA for developers.
I missed that part -- but at a quick glance it doesn't seem much more
useful than a C interface.
If the library is C, I would use C. If it is C++, I would use C++,
not C. I find it useful to use C++ library by C++ API as opposite
to using a C++ lib by C API. BTW, plugins do know internals
of the main program with libraries and can freely use them.
One can just use C++, observing the same principles: ODR (put
each plugin in its own namespace) and other code correctness.
Technically build adjustments need to be made, see gcc faq on DSO.
In short for RTTI type information is by default pulled in on ELF
during linking, and loader does not see it, because linker does not
export it. So to get exceptions, templates and other such beasts
working, one needs to export all symbols (-E) and then the loader
can do its job during dlopen().
Edek