title: minpack fortran .dll for use in c#
body: <p>I am trying to include minpack, which is written in FORTRAN and is used for least square solutions to underdetermined maths problems, in my c# windows form solution.</p>
  
  <p>I have read that it is possible to compile the minpack fortran subroutines, of which there are 7 (all in separate files) into a .dll, which I can then add as a reference to my c# program in visual studio 2012.</p>
  
  <p>I have been attempting to do this now for 2 days with not much luck.  I have downloaded GCC GNU to compile the fortran files.  My steps so far are:</p>
  
  <p>1) compile fortran files to Common Object File Format (COFF *.o) files using the syntax "gcc -c filename1.f" in the mingw64env command prompt for all 7 files</p>
  
  <p>2) I have then compiled these files together into a shared executable using the syntax "gcc -shared -o mindpack.dll filename1.o filename2.o filename3.o..."</p>
  
  <p>this outputs a .dll file with no reported errors.</p>
  
  <p>3) But when I try to add it as a reference to my windows forms project (c#) I get the error message "A reference to '*.dll' could not be added.  Please make sure that the file is accessible, and that it is a valid assembly or COM component."</p>
  
  <p>4) one of the suggestions to fix this was to find the file C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\TlbImp.exe and execute it with the syntax "TlbImp.exe minpack.dll" but this gives the error "TlbImp : error T10000 : The input file 'C:\mingw64\minpack.dll' is not a valid type library.</p>
  
  <p>Could anyone point me in the right direction as I've only started learning c# and some of the solutions online are over my head with things like header files and DEF files, im not sure if these are even relevant.</p>
  
  <p>If someone could lay out a solution to converting a collection of fortran subroutines into a single .dll file that can be called from c#, preferably using GCC GNU (or some other free software), it would be much appreciated.</p>
  
  <p>Thanks in advance.</p>