Xref: utzoo comp.lang.fortran:891 comp.lang.c:11194 Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!killer!ames!pasteur!ucbvax!hplabs!pyramid!mikel From: mikel@pyrps5 (Mike Lipsie) Newsgroups: comp.lang.fortran,comp.lang.c Subject: Re: Mixed linking (C with F77) Message-ID: <30520@pyramid.pyramid.com> Date: 9 Jul 88 21:06:49 GMT Sender: daemon@pyramid.pyramid.com Reply-To: mikel@pyrps5.UUCP (Mike Lipsie) Organization: Pyramid Technology Corp., Mountain View, CA Lines: 23 In article <604@riddle.UUCP> john@sphinx.co.uk (Jonathan Leffler) writes: >In article <3670@briar.Philips.Com> sxm@bebop.philips.com (Sandeep Mehta) writes: >>I cannot get to pass character strings from C to routines FORTRAN correctly >>(under UNIX) ? > >If you have or can get hold of a Version 7 Unix Programmer's >Manual Volume 2, the article on ``A Portable Fortran 77 >Compiler'' describes the interface between C and Fortran. Additionally, it is important to remember that C and FORTRAN strings are very different beasts. A C string is a piece of memory terminated by a null character while a FORTRAN string is a fixed piece of memory which may or may not contain null characters. Thus, in the example, the two strings which look identical would have different actual representations. The example that Jonathan included (that I omitted for space reasons) is valid only for one particular implementation (the standard VAX UNIX compilers). In general, interlanguage calling sequences are not portable. ----------- Mike Lipsie {allegra,cmcl2,decwrl,hplabs,ut-sally,utzoo}!pyramid!mikel Pyramid Technology Corp, Mountain View, CA +1 415 965 7200 ext. 4980