<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Understanding the classical model for linking: Taking symbols along for the ride</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/01/08/10383017.aspx</link><description>Auxiliary information associated with a symbol.</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Understanding the classical model for linking: Taking symbols along for the ride</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/01/08/10383017.aspx#10384038</link><pubDate>Thu, 10 Jan 2013 22:51:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10384038</guid><dc:creator>Gregory</dc:creator><description>&lt;p&gt;Can someone come up with a more concrete scenario then?&lt;/p&gt;
&lt;div class="post"&gt;[&lt;em&gt;See the entire printf discussion. -Raymond&lt;/em&gt;]&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10384038" width="1" height="1"&gt;</description></item><item><title>re: Understanding the classical model for linking: Taking symbols along for the ride</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/01/08/10383017.aspx#10383835</link><pubDate>Thu, 10 Jan 2013 13:59:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10383835</guid><dc:creator>Brian_EE</dc:creator><description>&lt;p&gt;@Gregory: Um, simply because it is a contrived example used to describe the issue in general terms maybe?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10383835" width="1" height="1"&gt;</description></item><item><title>re: Understanding the classical model for linking: Taking symbols along for the ride</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/01/08/10383017.aspx#10383634</link><pubDate>Wed, 09 Jan 2013 23:23:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10383634</guid><dc:creator>Gregory</dc:creator><description>&lt;p&gt;Why do we want magicNumber initialization to happen through g_InitMagicNumber exactly?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10383634" width="1" height="1"&gt;</description></item><item><title>re: Understanding the classical model for linking: Taking symbols along for the ride</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/01/08/10383017.aspx#10383593</link><pubDate>Wed, 09 Jan 2013 20:09:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10383593</guid><dc:creator>Mark</dc:creator><description>&lt;p&gt;I don&amp;#39;t get why you need __fltused. &amp;nbsp;I thought that something like 1.2 + 3.4 gets compiled into something like __fltadd(1.2, 3.4). &amp;nbsp;Then you can resolve __fltadd instead of a bogus symbol like __fltused.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10383593" width="1" height="1"&gt;</description></item><item><title>re: Understanding the classical model for linking: Taking symbols along for the ride</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/01/08/10383017.aspx#10383512</link><pubDate>Wed, 09 Jan 2013 16:37:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10383512</guid><dc:creator>Evan</dc:creator><description>&lt;p&gt;I suspect the use of &amp;quot;magic&amp;quot; to describe the operating of constructors and destructors is because by my understanding if you went back to, I dunno, 1980 runtimes, they wouldn&amp;#39;t get run. The g_InitMagicNumber symbol would be present, but wouldn&amp;#39;t do anything. (1980 is arbitrary. Maybe it&amp;#39;d have to be 1975 or something.)&lt;/p&gt;
&lt;p&gt;As Raymond&amp;#39;s latest response (to Brian_EE) suggests, even something like __fltused fits into the classical model of linking, and you&amp;#39;d be able to pull that trick with 1980 linkers.&lt;/p&gt;
&lt;div class="post"&gt;[&lt;em&gt;They get run even under the classical model, but by a technique not described in this series of articles (but described by Larry). -Raymond&lt;/em&gt;]&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10383512" width="1" height="1"&gt;</description></item><item><title>re: Understanding the classical model for linking: Taking symbols along for the ride</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/01/08/10383017.aspx#10383473</link><pubDate>Wed, 09 Jan 2013 14:48:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10383473</guid><dc:creator>Brian_EE</dc:creator><description>&lt;p&gt;@Myria:&lt;/p&gt;
&lt;p&gt;I understand how that works. I was questioning why Raymond considered it to be &amp;quot;magic&amp;quot;.&lt;/p&gt;
&lt;p&gt;And in DSP-land the section is called .init_array and is called in c_int00.&lt;/p&gt;
&lt;div class="post"&gt;[&lt;em&gt;It&amp;#39;s even more magical than the __fltused magic, since it employs a trick beyond merely resolving symbols. -Raymond&lt;/em&gt;]&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10383473" width="1" height="1"&gt;</description></item><item><title>re: Understanding the classical model for linking: Taking symbols along for the ride</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/01/08/10383017.aspx#10383431</link><pubDate>Wed, 09 Jan 2013 11:23:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10383431</guid><dc:creator>Neil</dc:creator><description>&lt;p&gt;Another version of the trick is when you have a dllexport symbol in a library; a fake reference to the symbol in an unused function in an explicit object file will cause the exported symbol to get resolved. Firefox used to do this but now they just skip the intermediate library step and simply link all their bazillion object files together.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10383431" width="1" height="1"&gt;</description></item><item><title>re: Understanding the classical model for linking: Taking symbols along for the ride</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/01/08/10383017.aspx#10383429</link><pubDate>Wed, 09 Jan 2013 11:19:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10383429</guid><dc:creator>Neil</dc:creator><description>&lt;p&gt;Thus the note in *printf pointing out that you couldn&amp;#39;t use any of the floating-point formats unless you actually did some floating-point operation that caused the floating-point library to get linked in.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10383429" width="1" height="1"&gt;</description></item><item><title>re: Understanding the classical model for linking: Taking symbols along for the ride</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/01/08/10383017.aspx#10383353</link><pubDate>Wed, 09 Jan 2013 03:39:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10383353</guid><dc:creator>Myria</dc:creator><description>&lt;p&gt;@alegr1:&lt;/p&gt;
&lt;p&gt;It&amp;#39;s sad that MASM doesn&amp;#39;t have a way to declare COMDATs. &amp;nbsp;If you use /Gy /Fa on cl.exe&amp;#39;s command line to generate function COMDATs and output assembly source, the COMDAT flag is only a comment. &amp;nbsp;If you were to assemble the output file, it wouldn&amp;#39;t have COMDATs.&lt;/p&gt;
&lt;p&gt;@Brian_EE:&lt;/p&gt;
&lt;p&gt;Global constructors work in Visual C++ by the compiler putting a pointer to the constructor into a specifically-named .obj section. &amp;nbsp;Part of the msvcrt startup code goes through the list of pointers in this section and calls each function; in Visual Studio 2010, that&amp;#39;s the function _initterm in crt0dat.c. &amp;nbsp;See also crt0init.c.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10383353" width="1" height="1"&gt;</description></item><item><title>re: Understanding the classical model for linking: Taking symbols along for the ride</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2013/01/08/10383017.aspx#10383305</link><pubDate>Tue, 08 Jan 2013 22:35:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10383305</guid><dc:creator>Joshua</dc:creator><description>&lt;p&gt;[The magic is how the constructor manages to run when there is no explicit caller. -Raymond]&lt;/p&gt;
&lt;p&gt;Maybe I should show Raymond how to make code run without an implicit caller either.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10383305" width="1" height="1"&gt;</description></item></channel></rss>