title: Crosscompiling libmcrypt as a static lib for MSVC
body: <p>I'm trying to use <a href="http://mcrypt.sourceforge.net/" rel="nofollow">libMcrypt</a> as a static lib for windows. My code is already using the dll port for it found <a href="http://files.edin.dk/php/win32/mcrypt/dev/" rel="nofollow">here</a>. 
  There does not exists a 'vcproj/solution' for the project so I did not know how to go about to compile it directly using visual studio. ( I was getting abundant errors when I tried to create one and compile)</p>
  
  <p>However, I could cross compile using MingW and get a windows dll which worked fine. I found the instructions <a href="https://wiki.physik.fu-berlin.de/linux-minidisc/doku.php?id=compilingwithmingw" rel="nofollow">here</a>. I then compiled a static lib for the same giving --enable=static as an option to configure. It created a .a and .la file successfully.</p>
  
  <p>But when I'm trying to use the compile lib, I'm getting the following linker errors in my project</p>
  
  <pre><code>libmcrypt.lib(loki97.o) : warning LNK4229: invalid directive '/aligncomm:_prm,5' encountered; ignored
  libmcrypt.lib(loki97.o) : warning LNK4229: invalid directive '/aligncomm:_sb2,5' encountered; ignored
  libmcrypt.lib(loki97.o) : warning LNK4229: invalid directive '/aligncomm:_sb1,5' encountered; ignored
  LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRT.lib(MSVCR100.dll)
  MSVCRT.lib(MSVCR100.dll) : error LNK2005: __strdup already defined in LIBCMT.lib(strdup.obj)
       Creating library ..\..\..\bin\myProj.lib and object ..\..\..\bin\myProj.exp
  LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
  libmcrypt.lib(blowfish-compat.o) : error LNK2001: unresolved external symbol ___chkstk_ms
  myProj.exp : error LNK2001: unresolved external symbol arcfour_LTX__is_block_algorithm
  myProj.exp : error LNK2001: unresolved external symbol arcfour_LTX__mcrypt_algorithm_version
  myProj.exp : error LNK2001: unresolved external symbol arcfour_LTX__mcrypt_decrypt
  myProj.exp : error LNK2001: unresolved external symbol arcfour_LTX__mcrypt_encrypt
  myProj.exp : error LNK2001: unresolved external symbol arcfour_LTX__mcrypt_get_algo_iv_size
  myProj.exp : error LNK2001: unresolved external symbol arcfour_LTX__mcrypt_get_algorithms_name
  myProj.exp : error LNK2001: unresolved external symbol arcfour_LTX__mcrypt_get_block_size
  </code></pre>
  
  <ol>
  <li>From the 1st two errors, I feel it is a CRT mismatch error. How can
  I give the option to gcc to build static lib without CRT? (I'm not
  sure if I'm thinking correct)</li>
  <li>Or can I use the .a file, extract obj files and recreate a lib from
  it?</li>
  <li>Has anyone compile a static lib for libMcrypt on Windows</li>
  </ol>
  
  <p>Thanks a lot for your help!</p>