[Haskell-cafe] Linker?

Gregory Crosswhite gcross at phys.washington.edu
Thu Nov 12 15:04:40 EST 2009

Does anyone know here how GHC links in object files from other  
languages?  I am getting a strange issue where it seems to be getting  
the calling convention on Fortran calls wrong.

Specifically, on one computer (Gentoo Linux) I have with gcc and  
gfortran v4.4 and ghc compiled using gcc v4.3, I have no problems at  

On another computer (a Mac) I have with gcc 4.0 and gfortran 4.4 and a  
binary of ghc installed (as downloaded from haskell.org), I run into  
problems.  Specifically, I noticed that the first parameter seems to  
get eaten when I declared a fortran routine as a function but not when  
I declare it as a subroutine.  So I went ahead and converted the  
fortran routines into subroutines, but then I get another crash  
elsewhere in the code where a module calls a LAPACK routine for  
reasons unknown;  I do not get this crash when running the same code  
path but called using a Python wrapper that uses gcc + gfortran + f2py  
rather than from my Haskell wrapper.

I thought that this might be a problem with mixing gcc 4.0 and  
gfortran 4.4 (and ultimately I think this might still be the case),  
but when I tried writing small test cases using *only* gcc and  
gfortran and not ghc, everything worked just fine.

Any thoughts?

- Greg

More information about the Haskell-Cafe mailing list