64-bit DLLs
Daniel Green
venix1 at gmail.com
Fri Jan 27 09:59:52 PST 2012
All tests pass. However, I see your problem.
In plaindll.d:
version(GNU){ // Workaround for linker error
void* _tlsstart; // First symbol of the TLS section
void* _tlsend;
//int _tls_callbacks_a; // Workaround for GDC/MinGW linker error
}
_tlsstart is the first symbol of the TLS section. _tlsend is the last
symbol of the TLS section. Together they are used by D to identify the
TLS memory region for a given thread. If they do not come from TLS
memory then things will not work right.
The MinGW runtime has equivalent symbols __tls_start and __tls_end.
This is not something likely to change as it's a Windows convention.
The version of MinGW/GDC you have should define _tlsstart and _tlsend
symbols automatically if WinMain, DllMain or _Dmain functions exist in
the current object file.
As of now MinGW/GDC uses alias __tls_start _tlsstart and alias __tls_end
_tlsend to satisfy those requirements where necessary.
It's the same with _tls_callbacks_a. Windows convention specifies __xl_a.
The currently posted MinGW64 binaries have an alignment issue with TLS
memory in 64-bit mode. It's a segfault that will manifest in the
garbage collector.
I'll release updated binaries tonight.
More information about the D.gnu
mailing list