Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum external symbol length

Tags:

c++

dll

linker

I have two questions regarding maximum external symbol length in C++ (global variable, function, class, etc. name):

  1. What is the maximum external symbol length in GNU ld and other linkers for C++ language (static linking)?

  2. What is the maximum external symbol length for dynamic link libraries on Linux, Windows (dynamic linking)?

like image 619
Hrant Avatar asked Mar 25 '26 03:03

Hrant


1 Answers

This (and many other things) is implementation-defined, as mentioned in the Annex B of the standard. The standar does, however, recommend a minimum limit of 1024 characters, noting that it is only a recommendation:

Because computers are finite, C++ implementations are inevitably limited in the size of the programs they can successfully process. Every implementation shall document those limitations where known.

<...>

The limits may constrain quantities that include those described below or others. The bracketed number following each quantity is recommended as the minimum for that quantity. However, these quantities are only guidelines and do not determine compliance.

<...>

Number of characters in an external identifier [1 024]

Which means that the answer to your question may vary depending on compiler/linker version and target OS.

like image 181
SingerOfTheFall Avatar answered Mar 26 '26 15:03

SingerOfTheFall