[C++-sig] Loading Boost.Python made bindings is horribly slow?

Niall Douglas s_sourceforge at nedprod.com
Sat Apr 3 00:22:35 CEST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2 Apr 2004 at 14:06, Jonathan Brandmeyer wrote:

> {
>         global:
>                 initcvisual;
>         local:
>                 *;
> };
> 
> Now, the only function that is exported is extern "C" initcvisual()
> and the resulting cvisual.so file size is very significantly reduced.
> (from about 3MB to 1.5 MB for me).  You have to add the option
> -Wl,--version-script=$(MAPFILE_NAME) to the link command when invoking
> the linker via G++ to make use of this file.

Useful trick this - thanks for pointing it out. It took me some time 
(GNU ld seems very finickity about the grammar being exactly broken 
in the right places) but I got this:

TNFOXP1
{
  global:
    extern "C++"
    {
      initTnFOX;
      boost::*
    };
  local:
    extern "C++"
    {
      *
    };
};

As I patch Boost.Python in various places to enable multithreading 
support, it makes sense to bundle my patched BPL with the bindings. 
This is why I needed to work out how to specify C++ identifiers.

This method is not perfect on anything more varied eg; a general 
purpose library. Studying the dynamic symbol table using "nm -C -D 
<sofile>" shows symbols which match the wildcards leak out in a 
chance-like fashion. What we really need is Windows-style specifiers 
embedded directly into the source.

If I get some time this week, I may give a bash at patching GCC. Then 
we can simply reuse the macros defining Windows DLL support to do the 
same on POSIX.

Cheers,
Niall





-----BEGIN PGP SIGNATURE-----
Version: idw's PGP-Frontend 4.9.6.1 / 9-2003 + PGP 8.0.2

iQA/AwUBQG3nrMEcvDLFGKbPEQIClQCgrt1p2c6Z/WoviTyMbW0UcSPXDScAnj59
Ltfgs0FjUey+eNYScSC9HJcQ
=ZK8C
-----END PGP SIGNATURE-----




More information about the Cplusplus-sig mailing list