Modern C++ Lamentations

Jonathan M Davis newsgroup.d at jmdavisprog.com
Fri Jan 4 03:48:49 UTC 2019


On Thursday, January 3, 2019 2:22:03 PM MST Ethan via Digitalmars-d wrote:
> On Thursday, 3 January 2019 at 19:36:52 UTC, Jonathan M Davis
>
> wrote:
> >From the last time I worked with Windows dlls, I remember quite
> >distinctly
> >
> > that doing anything like adding a symbol to the library meant
> > that it was incompatible with executables previously built with
> > it (which is not true for shared libraries on *nix - they only
> > break if the ABI for the existing symbols changes).
>
> That would surely break if you were looking up symbols by ordinal
> instead of by name. I didn't even know you could do that until I
> read the documentation for GetProcAddress closely - turns out the
> name parameter can be used as an ordinal.
>
> All exportable symbols are exported by their mangled name in to
> the DLL's export table. Resolving by mangle will give you a
> similar experience to *nix there.

That would be a significant improvement. Thanks for pointing that out.
If/when I have to deal with Windows dlls again, I'll have to look into that
- though honestly, in general, I don't see any reason to use shared
libraries for anything other than plugins (whether you're talking about *nix
or Windows). If you're dealing with system libraries that are shared by a
ton of programs on the system (e.g. openssl on *nix systems), then using
shared libraries can definitely be worth it (especially when the library is
likely to need security updates), but if you're distributing a program,
static libraries are far easier, and if a library isn't used by many
programs, then I think that the simplicity of static libraries is worth far
more than the small space gain of using a shared library. It's just with
plugins that you really don't have any choice.

Regardless, D should have full shared library support on all of its
supported platforms, and for those who care particularly about Windows,
hopefully, Benjamin Thaut's work can be finished in a timely manner. IIRC,
he did make a post about it a few months back looking for folks to try out
his branch of dmd so that any issues could be worked out. I have no clue how
long it will be before that work gets merged, but I expect that it will
happen at some point.

- Jonathan M Davis





More information about the Digitalmars-d mailing list