===Mangling=== [[https://en.wikiversity.org/wiki/Visual_C%2B%2B_name_mangling|Visual C++ name mangling]] {{ :lang:cpp:lieur:visual_c_name_mangling_-_wikiversity_2019-10-30_16_04_43_.html |Archive du 06/07/2019 le 30/10/2019}} [[https://www.agner.org/optimize/calling_conventions.pdf|Calling conventions]] {{ :lang:cpp:lieur:calling_conventions_15-08-2019.pdf |Archive du 15/08/2019 le 30/10/2019}} [[http://mearie.org/documents/mscmangle/|Microsoft C++ Name Mangling Scheme]] {{ :lang:cpp:lieur:microsoft_c_name_mangling_scheme_mearie.org_documents_2019-10-30_16_04_57_.html |Archive du 20/07/2006 le 30/10/2019}}
External functions with the ''%%__%%declspec(dllimport)'' attribute have prefix ''%%__%%imp_'' in all compilers except Borland.
[[http://www.kegel.com/mangle.html|C++ Name Mangling/Demangling]] {{ :lang:cpp:lieur:c_name_mangling_demangling_2019-10-30_16_05_08_.html |Archive du 30/04/2002 le 30/10/2019}} * Demangler on-line https://d.fuqu.jp/c++filtjs/ https://demangler.com ===Les méthodes définies dans un entête ont un attribut weak=== Le corps d'une méthode ''template'' doit être identique quelque soit le fichier objet généré. Les méthodes ''template'' étant compilés dans chaque fichier objet (possibilité de nombreux doublons), le compilateur va leur donner l'attribut ''weak''. Si l'implémentation n'est toujours identique, le compilateur va en prendre une au hasard et la généraliser. * Exemple : {{gh>https://github.com/bansan85/wiki_le_garrec_fr/blob/master/cpp/linker/weak/Entete.h}} {{gh>https://github.com/bansan85/wiki_le_garrec_fr/blob/master/cpp/linker/weak/ClasseA.h}} {{gh>https://github.com/bansan85/wiki_le_garrec_fr/blob/master/cpp/linker/weak/ClasseB.h}} {{gh>https://github.com/bansan85/wiki_le_garrec_fr/blob/master/cpp/linker/weak/ClasseA.cpp}} {{gh>https://github.com/bansan85/wiki_le_garrec_fr/blob/master/cpp/linker/weak/ClasseB.cpp}} {{gh>https://github.com/bansan85/wiki_le_garrec_fr/blob/master/cpp/linker/weak/main.cpp}} * Symboles : {{gh>https://github.com/bansan85/wiki_le_garrec_fr_travis/blob/master/cpp/linker/weak/ClasseA.cpp.nm}} {{gh>https://github.com/bansan85/wiki_le_garrec_fr_travis/blob/master/cpp/linker/weak/ClasseB.cpp.nm}} On voit que le symbole ''Entete::go()'' est défini deux fois avec l'attribut weak. Mais le ''#define'' étant différent, les deux implémentations sont différentes.