When executing the a.out file i get a segmentation fault in line 27 (which is the function call of dgemv):
Program received signal SIGSEGV, Segmentation fault. 0x00002aaaaaba31f7 in dgemv_ () from /opt/intel/Compiler/11.1/069/mkl/lib/intel64/libmkl_intel_lp64.so (gdb) bt #0 0x00002aaaaaba31f7 in dgemv_ () from /opt/intel/Compiler/11.1/069/mkl/lib/intel64/libmkl_intel_lp64.so #1 0x00000000004012c5 in main () at useblas.c:27
My code was running on: Intel Xeon CPU X7460 @ 2.66GHz.
Calling the Fortran library from C is possible but the calling conventions are not the same. See the Mixed Language Programming chapters in the Intel Fortran Users' Guide.
Depending on the compilers and platform used, it may be possible to make it appear as if you are calling one library routine from either C or Fortran. For example, if in C you have dgemv(...), in the compiled code there may be a reference to _dgemv, where as a corresponding call in Fortran may result in a reference to _DGEMV. The linker matches up the reference with the appropriate library routine. Users who know only one of the two languages may find this method easier to use.
On the other hand, one may want the Fortran library routine to be called directly from C, without going through a C wrapper around the Fortran library routine. In this case, one has to know how the two languages correspond as to types, call by value/call by reference, etc.
If the Fortran Lapack routines are called directly from C, it should be kept in mind that C and Fortran have different conversions for representing two-dimensional arrays. The difference may not matter if a full, symmetric matrix is being passed but, in all other cases, care is necessary.
I would throw my 2 cents in this discussion: Tim, as an additional info please look at the MKL User'sGuide. See Chapter7,Mixed-language Programming with Intel MKL. You can find there link to the 2 examples ( 7.2 and 7.3) show how to call Fortran routines fromC-languageprograms.