title: Compiling libmagic statically (c/c++ file type detection)
body: <p>Thanks to the guys that helped me with my <a href="https://stackoverflow.com/questions/2105816/trying-to-use-include-compile-3rd-party-library-libmagic-c-c-filetype-detecti">previous question</a> (linked just for reference).</p>
  
  <p>I can place the files <code>fileTypeTest.cpp</code>, <code>libmagic.a</code>, and <code>magic</code> in a directory, and I can compile with <code>g++ -lmagic fileTypeTest.cpp fileTypeTest</code>. Later, I'll be testing to see if it runs in Windows compiled with MinGW.</p>
  
  <p>I'm planning on using <a href="http://sourceforge.net/projects/libmagic/" rel="nofollow noreferrer">libmagic</a> in a small GUI application, and I'd like to compile it statically for distribution. My problem is that <code>libmagic</code> seems to require the external file, <code>magic</code>. (I'm actually using my own shortened and compiled version, magic_short.mgc, but I digress.)</p>
  
  <p>A hacky solution would be to code the file into the application, creating (and deleting) the external file as needed. How can I avoid this?</p>
  
  <p>added for clarity:</p>
  
  <p><code>magic</code> is a text file that describes properties of different filetypes. When asked to identify a file, <code>libmagic</code> searches through <code>magic</code>. There is a compiled version, <code>magic.mgc</code> that works faster. My application only needs to identify a handful of filetypes before deciding what to do with them, so I'll be using my own <code>magic_short</code> file to create <code>magic_short.mgc</code>.</p>