<div dir="ltr"><div class="gmail_default" style="font-family:courier new,monospace">See answers below.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 14, 2013 at 8:59 PM, Dallman, John <span dir="ltr"><<a href="mailto:john.dallman@siemens.com" target="_blank">john.dallman@siemens.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div lang="EN-GB" link="blue" vlink="purple">
<div><div class="im">
<p class="MsoNormal"><span style="font-family:"Courier New"">> some of my functions which are not used in the final
</span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">> executable are optimized away by the clang++ linker.
</span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">> Is there any way to prevent clang++ to strip away
</span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">> these functions ? </span>
</p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">The obvious question first: why is this a problem? If they are not used, why do you need them?</span></p>
</div></div></blockquote><div><br></div><div class="gmail_default" style="font-family:'courier new',monospace">I want to pass them to libraries later loaded into the application.</div><div class="gmail_default" style="font-family:'courier new',monospace">
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-GB" link="blue" vlink="purple"><div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">An easy way to keep them around is to create a reference to them, so that they are "used"</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">in some way. Calls to them, or pointers to them stored in globals, should do the trick.  </span></p>
</div></div></blockquote><div><br></div><div class="gmail_default" style="font-family:'courier new',monospace">If the global is not used, would the linker be able to optimize the global out and in turn optimize the function out again ?</div>
<div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace">Thank you </div><div class="gmail_default" style="font-family:'courier new',monospace">
<br></div><div class="gmail_default" style="font-family:'courier new',monospace">Trent</div><div class="gmail_default" style="font-family:'courier new',monospace"> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-GB" link="blue" vlink="purple"><div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">--
</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">John Dallman
</span><span style="font-family:"Courier New""></span></p>
</div>
<p style="font-family:Arial;font-size:70%">-----------------<br>
Siemens Industry Software Limited is a limited company registered in England and Wales.<br>
Registered number: 3476850.<br>
Registered office: Faraday House, Sir William Siemens Square, Frimley, Surrey, GU16 8QD.
</p>
</div>

</blockquote></div><br></div></div>