Pragma mangle and D shared objects

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Oct 25 20:31:10 PDT 2014


On Sat, Oct 25, 2014 at 10:54:53PM -0400, Etienne Cimon via Digitalmars-d-learn wrote:
> On 2014-10-25 21:26, H. S. Teoh via Digitalmars-d-learn wrote:
> >Not sure what nm uses, but a lot of posix tools for manipulating
> >object files are based on binutils, which understands the local
> >system's object file format and deal directly with the binary
> >representation. The problem is, I don't know of any *standard* system
> >functions that can do this, so you'd have to rely on OS-specific
> >stuff to make it work, which is less than ideal.
> >
> 
> Which makes it better to export the mangling into a container at
> compile-time! That way, you can build a standard interface into DLLs
> so that other D application know what they can call =)

Hmm. You can probably use __traits(getAllMembers...) to introspect a
library module at compile-time and build a hash based on that, so that
it's completely automated. If you have this available as a mixin, you
could just mixin(exportLibrarySymbols()) in your module to produce the
hash.


T

-- 
"Holy war is an oxymoron." -- Lazarus Long


More information about the Digitalmars-d-learn mailing list