www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Linking error: unresolved external symbol internal

reply MrSmith <mrsmith33 yandex.ru> writes:
I have a static library and an application.

When linking final executable I get:
     lib.lib(texteditor_1d_40c.obj) : error LNK2001: unresolved 
external symbol internal
     lib.lib(textbuffer_14_3ce.obj) : error LNK2001: unresolved 
external symbol internal

Happens on Windows 32 and 64 bit.
Only with debug build.
DMD 2.076.0
Error doesn't happen when I move code from library to the 
application.

Here is reduced test case (where 2 errors happen, 4 files): 
https://gist.github.com/MrSmith33/29125fa3538bb03637d0aebab6ccff7c
Here is smaller case (only 1 error, 2 files): 
https://gist.github.com/MrSmith33/dc53d8cb6ce642fcb6dbc5863d029cec


If this is relevant: 3 places I found in dmd where "internal" 
symbol is created:
* 
https://github.com/dlang/dmd/blob/4d86fcba2fd2ef86cc85738cd2ac2b059dbb5800/src/ddmd/backend/dt.c#L420
* 
https://github.com/dlang/dmd/blob/4d86fcba2fd2ef86cc85738cd2ac2b059dbb5800/src/ddmd/tocsym.d#L662
* 
https://github.com/dlang/dmd/blob/4d86fcba2fd2ef86cc85738cd2ac2b059dbb5800/src/ddmd/tocsym.d#L681
Oct 10
parent Steven Schveighoffer <schveiguy yahoo.com> writes:
On 10/10/17 11:09 AM, MrSmith wrote:
 I have a static library and an application.
 
 When linking final executable I get:
      lib.lib(texteditor_1d_40c.obj) : error LNK2001: unresolved external 
 symbol internal
      lib.lib(textbuffer_14_3ce.obj) : error LNK2001: unresolved external 
 symbol internal
 
 Happens on Windows 32 and 64 bit.
 Only with debug build.
 DMD 2.076.0
 Error doesn't happen when I move code from library to the application.
 
 Here is reduced test case (where 2 errors happen, 4 files): 
 https://gist.github.com/MrSmith33/29125fa3538bb03637d0aebab6ccff7c
 Here is smaller case (only 1 error, 2 files): 
 https://gist.github.com/MrSmith33/dc53d8cb6ce642fcb6dbc5863d029cec
 
 
 If this is relevant: 3 places I found in dmd where "internal" symbol is 
 created:
 * 
 https://github.com/dlang/dmd/blob/4d86fcba2fd2ef86cc85738cd2ac2b059dbb5800/src/dd
d/backend/dt.c#L420 
 
 * 
 https://github.com/dlang/dmd/blob/4d86fcba2fd2ef86cc85738cd2ac2b059dbb5800/sr
/ddmd/tocsym.d#L662 
 
 * 
 https://github.com/dlang/dmd/blob/4d86fcba2fd2ef86cc85738cd2ac2b059dbb5800/sr
/ddmd/tocsym.d#L681 
 
No idea exactly what causes it, but here is another place I've seen it: https://issues.dlang.org/show_bug.cgi?id=17740 -Steve
Oct 10