<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7650.28">
<TITLE>RE: [CMake] Fortran-C mixed code (possible solution)</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>&gt;&gt; 2) A typical Fortran-C interface library (and we provide such<BR>
&gt;&gt; libraries for 3 different solvers) contains around 30<BR>
&gt;&gt; different functions which would then require 180 wrappers<BR>
&gt;&gt; (for all combinations lower/upper case and none/one/two<BR>
&gt;&gt; underscores)! A nightmare of (unnecessary) code duplication.<BR>
&gt;<BR>
&gt;Not necessarily:<BR>
&gt;You can put the actual wrapper functions in a separate file and &gt;include it several times, like this:<BR>
&gt;<BR>
&gt;#define suba SUBA<BR>
&gt;#include &quot;wrappers.h&quot;<BR>
&gt;#define suba SUBA_<BR>
&gt;#include &quot;wrappers.h&quot;<BR>
&gt;#define suba SUBA__<BR>
&gt;#include &quot;wrappers.h&quot;<BR>
&gt;...<BR>
&gt; Maybe not the most elegant way to solve it, but somewhere<BR>
&gt; you need the six combinations of case/appended underscores.<BR>
<BR>
Correct me if I'm wrong, but I believe there are some<BR>
FORTRAN compilers which change the number of underscores<BR>
appended depending on whether the name already contains<BR>
an underscore (the g77 documentation on -funderscoring, -fno-underscoring, and -fno-second-underscore mentions<BR>
this). So perhaps more effort is required. :-(<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; David</FONT>
</P>

</BODY>
</HTML>