Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In general, if you want a function to be included in the final library / executable, it need be:</p> <ul> <li>used</li> <li>non-inlined</li> </ul> <p>And <code>inlined</code> function is a function whose code is simply copied and pasted where the function is used (by the compiler) so that there is no function call. It's an opportunity optimization, so a function may be inlined in some places and not inlined in others, depending on the context. Most very short functions (so-called one-liners) are generally inlined.</p> <p>In the old times, to be inlined a function needed be defined in the current translation unit, that is:</p> <ul> <li>either it is defined in the header (like is your case), and thus can be inlined in all sources including this header</li> <li>either it is defined in a source file, and thus can be inlined in <em>this</em> source file</li> </ul> <p>Nowadays though we also have LTO (Link Time Optimization), and if activated the linker may actually inline function calls. Those optimizations are also responsible for cleaning up the resulting library/binary from <em>unused</em> symbols.</p> <p>There are two possible solutions to your issue:</p> <ul> <li>define the function in a source file instead, it is standard and may not be wiped out</li> <li>use compiler specific attributes to mark the function as used, so that it's not wiped out</li> </ul> <p>In the latter case, if you wish for portability, I can only advise using a macro (<code>ATTRIBUTE_USED</code>) and define its content depending on the current compiler used.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload