I also experimented with GDC from bitbucket sources in -v2 mode to compile the library, trying to associate some D functions with a C ++ application.
I found the same problem with a missing link to _tlsstart and _tlsend. A partial solution is to include the "main" function in the library:
void main(){}
I am working with a static library in linux. I checked the resulting static library with:
nm libDexample.a
This shows that the above trivial basic inserts of extra characters in libDexample.d (which are also included in the C ++ executable):
_Dmain _tlsend _tlsstart
Of course, these symbols give reference errors related to several definitions if the library is used in Appendix D. Therefore, you can define a separate library, for example libtls.d, containing:
extern(C) void make_it_link_please(){}
If one of the links is related to libtls in the case of a C ++ application, but not to the D application.
source share