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

Arjen Markus arjen.markus at wldelft.nl
Wed Jan 24 10:07:37 EST 2007


Radu Serban wrote:

>
>
> I've added this to my implementation (attached to this message). If 
> successful, the name mangling scheme is encoded in two (cached, 
> internal) variables: SCHEME_NO_UNDERSCORES is the mangled name of the 
> symbol "mysub" and SCHEME_WITH_UNDERSCORES is the mangled name of the 
> symbol "my_sub". The way I use them is by further defining two 
> substitution variables which I use to generate a configuration header 
> (using CONFIGURE_FILE). These variables (DEFINE_F77_FUNC and 
> DEFINE_F77_FUNC_) contain the #define lines for two C preprocessor 
> macros, F77_FUNC and F77_FUNC_ which can then be used in the C code. 
> As an example, using the GNU compilers (without any of the g77 flags 
> you mention) these two macros will be:
> #define F77_FUNC(name,NAME) name ## _
> #define F77_FUNC_(name,NAME) name ## __
>
> I've tested this with the GNU compilers (with and without the flags 
> you mentioned), as well as with PGI and Intel compilers (all under 
> Linux). I hope it's portable but, unfortunately, I don't have a 
> Windows machine to try it on...
>
Hi Radu,

I took a look at this new version of the script. It seems indeed more 
portable than
the first version, but I must warn you that there are a few other issues 
on Windows
that you need to take care of (there is the matter of the calling 
convention, indicated
by the special keyword stdcall__ or the like and the positioning of the 
implicit
string length argument). I am not sure how these can be automatically 
determined.

Regards,

Arjen




More information about the CMake mailing list