Returning values from C function?
Jeremy Cowgar
jeremy@cowgar.com
Wed Dec 27 01:38:00 GMT 2006
Quoting erik.edelmann@iki.fi <erik.edelmann@iki.fi>:
> One thing that could go wrong is that the C function 'printf' expects
> strings to be NULL terminated (i.e., it will continue to print characters
> until it finds a '\0'-character). In fortran, however, strings are not in
> general NULL terminated. Printing a string in C code that was passed from
> Fortran code can therefore sometimes result in some extra garbage being
> printed.
What is the proper way of passing a string to C? I have attempted to google
for some good instructions on interfacing gfortran with C but I am failing.
Jeremy
More information about the Fortran
mailing list