On Jan 21, 2010, at 10:22 AM, Jed Brown wrote: > On Thu, 21 Jan 2010 09:17:22 -0600, Mark Moll <mm...@cs.rice.edu> wrote: >> You *can* use the Fortran BLAS/LAPACK libraries with C/C++ code. > > Yes, this is actually very common, but check_fortran_function_exists > works by trying to link an actual Fortran program. When calling from C, > you have to know how Fortran names are mangled which means testing a > number of common choices. Nobody put this logic into these Find > modules, but it would be nice because many (most?) users of BLAS/Lapack > need to call it from both Fortran and C so they need to know how the > symbols are mangled. CBLAS/CLapack are entirely different beasts, but I > know of far more C projects that call the Fortran versions directly than > use the C bindings.
Wouldn’t it be possible to use “nm” to detect the Fortran name mangling? For example: On OS X, default LAPACK library: > nm /usr/lib/liblapack.dylib | grep cheev$ | awk '{print $3}’ _cheev On Linux, using MKL: > nm /opt/intel/Compiler/11.1/056/mkl/lib/em64t/libmkl_intel_lp64.a | grep > cheev$ | awk '{print $3}' cheev (Of course the “grep” and “awk” commands can be replaced with some cmake string commands, if you want to make it a bit more portable.) -- Mark _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake