[CMake] Fortran-C mixed code (possible solution)

Thompson, David C dcthomp at sandia.gov
Mon Jan 22 04:09:43 EST 2007


>> 2) A typical Fortran-C interface library (and we provide such 
>> libraries for 3 different solvers) contains around 30
>> different functions which would then require 180 wrappers
>> (for all combinations lower/upper case and none/one/two
>> underscores)! A nightmare of (unnecessary) code duplication.
>
>Not necessarily:
>You can put the actual wrapper functions in a separate file and >include it several times, like this:
>
>#define suba SUBA
>#include "wrappers.h"
>#define suba SUBA_
>#include "wrappers.h"
>#define suba SUBA__
>#include "wrappers.h"
>...
> Maybe not the most elegant way to solve it, but somewhere
> you need the six combinations of case/appended underscores.

Correct me if I'm wrong, but I believe there are some
FORTRAN compilers which change the number of underscores
appended depending on whether the name already contains
an underscore (the g77 documentation on -funderscoring, -fno-underscoring, and -fno-second-underscore mentions
this). So perhaps more effort is required. :-(

      David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070122/e77e170f/attachment.htm


More information about the CMake mailing list