Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
Date: Mon, 20 Nov 2000 17:58:07 +0200
Message-Id: <200011201558.RAA09888@linux.>
From: "Ehud Karni" <ehud@unix.simonwiesel.co.il>
To: erik.nim@risoe.dk
Subject: Re: C calls to Fortran with strings
CC: cygwin@sourceware.cygnus.com
In-reply-to: <7F6BCF6B9307D311980C0090273C746C020CBAD4@cssrv1>
	(erik.nim@risoe.dk)
Organization: Simon & Wiesel Insurance agency
Reply-to: ehud@unix.simonwiesel.co.il
References:  <7F6BCF6B9307D311980C0090273C746C020CBAD4@cssrv1>
X-Mailer: Emacs 20.7.1 rmail (send-msg 1.104)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-8
Content-Transfer-Encoding: 7bit

On Mon, 20 Nov 2000 16:29:32 +0100, erik.nim@risoe.dk wrote:
> 
> I am using the gcc compiler under Cygwin on a NT platform for applications
> where I call Fortran subroutines from C code. This is working smoothly with
> one strange exception: If more than one string are present in Fortran
> subroutines the program crashes. Apparently everything works with ONE string
> only. The following simple example illustrates the problem: 
[snip]
> extern void sub1_(char *s1, unsigned int);
> extern void sub2_(char *s1, unsigned int, char *s2, unsigned int);
[snip]
>       SUBROUTINE SUB1(S1)
[snip]
>       SUBROUTINE SUB2(S1, S2)

If my memory serves me right, you have defined the SUB2 wrongly.
The correct definition should be:
    extern void sub2_ (char *s1, char *s2, unsigned l1, unsigned l2);
As I recall the string lengths always come after all the real formal
parameters (not directly after the string pointer).
(I can't check it at the moment so please check it and report back).

Ehud.


-- 
 @@@@@@ @@@ @@@@@@ @    @   Ehud Karni  Simon & Wiesel  Insurance agency
     @    @      @  @@  @   Tel: +972-3-6212-757    Fax: +972-3-6292-544
     @    @ @    @ @  @@    (USA)  Fax  and  voice  mail:  1-815-5509341
     @    @ @    @ @    @        Better     Safe     Than     Sorry
 http://www.simonwiesel.co.il    mailto:ehud@unix.simonwiesel.co.il

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

