Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #11175

Re: Anything new on run-time libraries loading?

From Edek <edek.pienkowski@gmail.com>
Newsgroups comp.lang.c++
Subject Re: Anything new on run-time libraries loading?
Date 2011-11-01 11:28 +0100
Organization ATMAN - ATM S.A.
Message-ID <j8ohig$7s2$1@node2.news.atman.pl> (permalink)
References <2u8yuf1f8xnx$.dlg@localhost.localdomain> <46010469-4b5a-4c7c-bc88-f202f3df0841@q13g2000vbd.googlegroups.com>

Show all headers | View raw


On 10/31/2011 08:34 PM, Goran wrote:
> On Oct 31, 6:54 pm, "Waldek M."<w...@localhost.localdomain>  wrote:
>> Hello,
>>
>> The standard way for loading libraries on runtime (in this case, for
>> Linux/Unix systems) is dlsym/dlopen&  friends.
>> The catch is, libraries written with C++ need to have some
>> kind of "C" interface (hence not mangled) that would allow access to C++
>> objects, at least supporting creation and destruction, like here:http://tldp.org/HOWTO/C++-dlopen/thesolution.html
>>
>> And my question: does the new C++ standard address this issue somehow?
>> Or, is there any more comfortable (still standard compliant) way to achieve
>> the same goal?
>
> I think both C and C++ languages have no notion whatsoever of
> libraries, *.so or *.lib, including latest C++ spec.

Why would they? If they would, they would need to include llvm IR
binaries too (they are for example for JIT, still being c++).

>
> I personally think they should never get that. C-level
> "interoperability" on library level works primarily because C is so
> simple. 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. Pffft...

Speaking of dlsym/dlopen, there is binary compatibility. While I don't
know all platforms, compilers often agree to the same ABI, so it
is absolutely no problem to share data and call the code. All you
need is a little wrapper for _dynamically_ loaded libs, which are
plugins or whatever and this wrapper is not needed for every
interaction, just for one (or a couple) entry points used
as an object factory. So except for the factory stuff, not much
more is needed - an API of course, but it does not require
any C linkage, it can be just regular C++.

The whole point of that is not binary compatibility, but
the fact that in C++ one cannot call methods (constructors are
also callable) of unknown at compilation time name and arguments.

The possible problem with new does exist, but some things
may be decided by the policy of plugin integration, which
is needed anyway. There are many applications with plugins,
none of them uses CORBA or anything similar.

Edek

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Anything new on run-time libraries loading? "Waldek M." <wm@localhost.localdomain> - 2011-10-31 18:54 +0100
  Re: Anything new on run-time libraries loading? Goran <goran.pusic@gmail.com> - 2011-10-31 12:34 -0700
    Re: Anything new on run-time libraries loading? legalize+jeeves@mail.xmission.com (Richard) - 2011-11-01 05:28 +0000
      Re: Anything new on run-time libraries loading? Ian Collins <ian-news@hotmail.com> - 2011-11-01 19:49 +1300
      Re: Anything new on run-time libraries loading? Dombo <dombo@disposable.invalid> - 2011-11-01 20:30 +0100
        Re: Anything new on run-time libraries loading? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-11-02 06:08 +0000
          Re: Anything new on run-time libraries loading? Edek <edek.pienkowski@gmail.com> - 2011-11-02 10:03 +0100
            Re: Anything new on run-time libraries loading? Dombo <dombo@disposable.invalid> - 2011-11-02 19:38 +0100
            Re: Anything new on run-time libraries loading? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-11-03 18:26 +0000
              Re: Anything new on run-time libraries loading? Edek <edek.pienkowski@gmail.com> - 2011-11-03 20:07 +0100
    Re: Anything new on run-time libraries loading? "Waldek M." <wm@localhost.localdomain> - 2011-11-01 08:28 +0100
    Re: Anything new on run-time libraries loading? Edek <edek.pienkowski@gmail.com> - 2011-11-01 11:28 +0100
  Re: Anything new on run-time libraries loading? Paavo Helde <myfirstname@osa.pri.ee> - 2011-11-01 16:34 -0500
    Re: Anything new on run-time libraries loading? Edek <edek.pienkowski@gmail.com> - 2011-11-02 10:01 +0100
      Re: Anything new on run-time libraries loading? Paavo Helde <myfirstname@osa.pri.ee> - 2011-11-02 17:03 -0500
        Re: Anything new on run-time libraries loading? Edek <edek.pienkowski@gmail.com> - 2011-11-03 20:40 +0100
        Re: Anything new on run-time libraries loading? "Waldek M." <wm@localhost.localdomain> - 2011-11-03 21:06 +0100

csiph-web