Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Lawrence D'Oliveiro Newsgroups: comp.lang.fortran Subject: Re: how do you send a fortran character string from GCC to GFortran ? Date: Fri, 3 Jan 2025 00:30:39 -0000 (UTC) Organization: A noiseless patient Spider Lines: 16 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Fri, 03 Jan 2025 01:30:39 +0100 (CET) Injection-Info: dont-email.me; posting-host="c1dc6161c0b733ffa77e30ced8836776"; logging-data="3757042"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+iito//tT1WNQuSfSgoGF3" User-Agent: Pan/0.161 (Chasiv Yar; ) Cancel-Lock: sha1:ooUHENBEcSvcCpf+1eXVerEFAr0= Bytes: 1741 On Thu, 2 Jan 2025 02:27:54 -0600, Lynn McGuire wrote: > How do you send a fortran character string from GCC to GFortran ? Seems like trying to call Fortran routines from C is not quite straightforward. Looking at the (draft?) Fortran 2023 spec, page 514 says: In a reference from C to a Fortran procedure with an interoperable interface, a C actual argument shall be the address of a C descriptor for the intended effective argument if the corresponding dummy argument interoperates with a C formal parameter that is a pointer to CFI_cdesc_t. The following section (page 516 onwards) defines these “C descriptors”. Or alternatively (back to page 514), you might need to declare your Fortran routine with the “BIND(C)” attribute.