title: Parsing .o files with WindowsApi?
body: <p>I am on a quest to find a function's size, in bytes. An old method I tried, which calculates the size at runtime:</p>
  <pre><code>DWORD function(){
  // Do something
  }
  DWORD functionEnd(){
  // Do nothing - meant to simply delimit the end of function()
  }
  
  DWORD size = function - functionEnd
  </code></pre>
  <p>Doesn't work. With this method I get random sizes, which are static, and therefore never change regardless of the contents of the function.</p>
  <p>Therefore, I thought of possibly compiling my function in another file into a .o object file and then parsing it, extracting the function in bytes from the .text section and calculating its size that way.</p>
  <p>However, searching on the web I have found nothing in the way of parsing a .o file with WindowsApi, albeit I found plenty information concerning doing this on Linux (<a href="https://blog.cloudflare.com/how-to-execute-an-object-file-part-1/" rel="nofollow noreferrer">https://blog.cloudflare.com/how-to-execute-an-object-file-part-1/</a>)</p>
  <p>So are there native Windows functions to do this?</p>