title: Retaining Compatibility To Assembly With inline Functions
body: <p>I'm writing some header files, which are to be accessed by both C code and assembly. Assembly code is preprocessed with the C preprocessor for this sake.</p>
  
  <p>The problem is I have plenty of <code>inline</code> functions in those header files. The assembler cannot process functions, which are not symbols in an object file (as with <code>static inline</code> functions), so I cannot use those. I've read <a href="https://stackoverflow.com/questions/216510/extern-inline/216546#216546">this</a> and <a href="https://gcc.gnu.org/onlinedocs/gcc/Inline.html" rel="nofollow noreferrer">this</a> invaluable posts and have grasped how to use <code>extern</code> and <code>static</code> in conjunction with <code>inline</code> by now but I am unsure about how to make <code>inline</code> function accessible to <strong>both</strong> C code and assembly.</p>
  
  <p>My current approach is to write <code>inline</code> functions (with >= GNU99, <code>-O3</code> inlines the function, anything else calls an external definition of that function, which I need to define explicitly) in a header file and write external definitions in an implementation file. The C code includes the header file (the <code>inline</code> functions) compiles with <code>-O3</code>, thus using the inlined versions. The assembly code uses the external definitions.</p>
  
  <p>Questions:</p>
  
  <ol>
  <li><p>The assembly code can only call the functions, inlining is currently impossible. Can assembly code, by any means, make use of inlining? I mean as in an <code>.S</code> file, not inline assembly.</p></li>
  <li><p><code>extern inline</code> would be similarly good as my current method but it boils down to just one definition (the external definition is emitted automatically), so it cannot be divided into header and source file, which is crucial to make it accessible to C code (header) and assembly (source).</p></li>
  <li><p>Is there any better method to achieve what I've been trying to do?</p></li>
  </ol>