Re: gcc vs gfortran

2019-12-06 Thread Patrick Dupre
OK, it is fixed, I compiled with the option -ff2c This was an error > > in C > > > > double complex a, b, z > > int lnchf ip > > out = conhyp_ (&a, &b, &z, &lnchf, &ip) ; > > The above isn't very close to C, e.g. ; is missing at the end of first line, > , and ; are missing around ip on the second

Re: gcc vs gfortran

2019-12-06 Thread Jakub Jelinek
On Fri, Dec 06, 2019 at 06:12:28PM +0100, Patrick Dupre wrote: > Actually, this is what I have: > > in C > > double complex a, b, z > int lnchf ip > out = conhyp_ (&a, &b, &z, &lnchf, &ip) ; The above isn't very close to C, e.g. ; is missing at the end of first line, , and ; are missing around i

Re: gcc vs gfortran

2019-12-06 Thread Tom Horsley
On Fri, 6 Dec 2019 18:12:28 +0100 Patrick Dupre wrote: > out = conhyp_ (&a, &b, &z, &lnchf, &ip) ; I don't know what "out" is, but if the return type of a fortran function is some struct-like object (which complex might qualify as), I believe there is a hidden first argument that is a pointer to

Re: gcc vs gfortran

2019-12-06 Thread Patrick Dupre
Actually, this is what I have: in C double complex a, b, z int lnchf ip out = conhyp_ (&a, &b, &z, &lnchf, &ip) ; In Fortran: FUNCTION CONHYP (A,B,Z,LNCHF,IP) INTEGER LNCHF,IP COMPLEX*16 CHGF,A,B,Z,CONHYP And what I get is A= b, B=z (the other values are wrong) It means that

Re: gcc vs gfortran

2019-12-06 Thread Patrick Dupre
    On Fri, 6 Dec 2019 at 06:31, Patrick Dupre wrote: Hello, Several times I called a fortran routine from a c program, it was OK. I am trying to do the same with complex numbers in the call. Is it a problem ? in c, I use double complex in f95, I use COMPLEX*16     Typo?

Re: gcc vs gfortran

2019-12-06 Thread George N. White III
On Fri, 6 Dec 2019 at 06:31, Patrick Dupre wrote: > Hello, > > Several times I called a fortran routine from a c program, it was OK. > I am trying to do the same with complex numbers in the call. > Is it a problem ? > in c, I use double complex > in f95, I use COMPLEX*16 > > Typo? From f2c.h

Re: gcc vs gfortran

2019-12-06 Thread Tom Horsley
On Fri, 6 Dec 2019 11:30:14 +0100 Patrick Dupre wrote: > in c, I use double complex > in f95, I use COMPLEX*16 Never heard of double complex in c. Fortran passes all arguments by reference, so a fortran routine that has a complex*16 arg probably needs something like this in C struct c16 { do

gcc vs gfortran

2019-12-06 Thread Patrick Dupre
Hello, Several times I called a fortran routine from a c program, it was OK. I am trying to do the same with complex numbers in the call. Is it a problem ? in c, I use double complex in f95, I use COMPLEX*16 my fortran cade translated to c by f2c does not work I get a segmentation fault: are the