calling C function from program.

Toon Moene toon@moene.indiv.nluug.nl
Fri Feb 15 12:26:00 GMT 2002


bjorn rohde jensen wrote:

>  I seem to recall, fortran char strings as having an implicit
> length field. C char strings have an implicit '\0' at the end.
> The C functions for string manipulation assume '\0' terminated
> strings, so you have to provide it with that.

While this is certainly true, the general issue is larger:  Calling C
routines from Fortran ones and vice versa isn't something that's covered
by any Standard (yet), so you have to read the documentation that goes
with the compiler to find out how this particular case is dealt with.

For g77 this means to read:

	http://gcc.gnu.org/onlinedocs/gcc-3.0.3/g77_16.html#SEC551

Cheers,

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)



More information about the Gcc-help mailing list