Bug 15496 – Documentation about special/'__' symbols

Status
RESOLVED
Resolution
MOVED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2016-01-02T01:25:42Z
Last change time
2022-10-28T09:03:09Z
Assigned to
No Owner
Creator
Manu

Comments

Comment #0 by turkeyman — 2016-01-02T01:25:42Z
DMD emit's a lot of special/magic symbols. In my current case, I'm piles of link errors like: error LNK2001: unresolved external symbol _D5libep6string12SharedString14__aggrPostblitMFNbNiZv error LNK2001: unresolved external symbol _D5libep6string12SharedString11__fieldDtorMFNbNiZv error LNK2001: unresolved external symbol _D5libep6string12SharedString15__fieldPostblitMFNbNiZv I don't know why, and I have no idea what those functions are supposed to do, or what actual functions those special names represent? Are they all compiler generated, or are they something that I'm supposed to write? There seems to be a massive suite of '__x' functions; I'd like to see a reference listing all possible such symbols that users may encounter, and explain what they are, and how they are written or generated. This isn't the first time I've wondered about the many '__' functions. The only reference that seems to exist are various hacks in phobos where there is code that occasionally checks if they exist to determine some sort of traits. This doc should ideally also include ClassInfo and any other magic symbols that exist.
Comment #1 by r9shackleford — 2016-01-02T08:20:48Z
This may be of interest to you: http://wiki.dlang.org/Runtime_Hooks AFAIK these aren't well documented. Hopefully they won't be because they're very, very old should be replaced by something better(e.g, AFAIK none of the hooks can even be inlined.) Bye.
Comment #2 by turkeyman — 2016-01-02T22:34:30Z
That's interesting. Although it doesn't list the 'normal'/expected ones, like __dtor/__postblit. It only talks about really obscure ones :P
Comment #3 by razvan.nitu1305 — 2022-10-28T09:03:09Z
The ones that are present in this bug report are listed here: https://dlang.org/spec/struct.html#struct-postblit (point 5) Probably not all of these symbols are documented, however, internal compiler symbols should not ever appear in user facing error messages. There are multiple bugs regarding this issues, so I'm going to close this one.