Re: nasty link problem with Gfortran and G++ (C++) ???

Liste des GroupesRevenir à cl fortran 
Sujet : Re: nasty link problem with Gfortran and G++ (C++) ???
De : tkoenig (at) *nospam* netcologne.de (Thomas Koenig)
Groupes : comp.lang.fortran
Date : 15. Jan 2025, 08:10:34
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vm7n1a$2rr87$2@dont-email.me>
References : 1 2 3 4
User-Agent : slrn/1.0.3 (Linux)
Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
On 1/14/2025 12:42 PM, Thomas Koenig wrote:
Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
 
I found and fixed the problem with my code along with one of my
programmers.  I was not properly handling the size_t hidden argument
length value that GFortran adds to the character string arguments in my
C++ code.  Things are going better now.
 
Good to hear that.
 
Another thing that works well for gcc is to link everything with
the -flto option.
 
An example:
 
$ cat main.f90
program memain
   character *1 c
   call foo(c)
   print *,c
end
$ cat foo.c
void foo_(char *c)
{
   *c = 'A';
}
$ gfortran -flto  main.f90 foo.c
main.f90:3:13: warning: type of 'foo' does not match original declaration [-Wlto-type-mismatch]
     3 |   call foo(c)
       |             ^
foo.c:1:6: note: type mismatch in parameter 2
     1 | void foo_(char *c)
       |      ^
foo.c:1:6: note: type 'void' should match type 'long int'
foo.c:1:6: note: 'foo_' was previously declared here
>
I will try it.

Just a warning - be prepared for loooong compile times. 

Date Sujet#  Auteur
7 Jan 25 * nasty link problem with Gfortran and G++ (C++) ???22Lynn McGuire
7 Jan 25 +* Re: nasty link problem with Gfortran and G++ (C++) ???16Thomas Koenig
8 Jan 25 i+* Re: nasty link problem with Gfortran and G++ (C++) ???5Lynn McGuire
8 Jan 25 ii`* Re: nasty link problem with Gfortran and G++ (C++) ???4Thomas Koenig
8 Jan 25 ii `* Re: nasty link problem with Gfortran and G++ (C++) ???3Lynn McGuire
8 Jan 25 ii  `* Re: nasty link problem with Gfortran and G++ (C++) ???2Thomas Koenig
8 Jan 25 ii   `- Re: nasty link problem with Gfortran and G++ (C++) ???1Steven G. Kargl
10 Jan 25 i`* Re: nasty link problem with Gfortran and G++ (C++) ???10Lynn McGuire
10 Jan 25 i `* Re: nasty link problem with Gfortran and G++ (C++) ???9Thomas Koenig
10 Jan 25 i  `* Re: nasty link problem with Gfortran and G++ (C++) ???8Lynn McGuire
11 Jan 25 i   `* Re: nasty link problem with Gfortran and G++ (C++) ???7Thomas Koenig
11 Jan 25 i    +* Re: nasty link problem with Gfortran and G++ (C++) ???2Lynn McGuire
11 Jan 25 i    i`- Re: nasty link problem with Gfortran and G++ (C++) ???1Thomas Koenig
12 Jan 25 i    `* Re: nasty link problem with Gfortran and G++ (C++) ???4baf
12 Jan 25 i     +- Re: nasty link problem with Gfortran and G++ (C++) ???1Lynn McGuire
12 Jan 25 i     `* Re: nasty link problem with Gfortran and G++ (C++) ???2Steven G. Kargl
13 Jan 25 i      `- Re: nasty link problem with Gfortran and G++ (C++) ???1baf
7 Jan 25 +- Re: nasty link problem with Gfortran and G++ (C++) ???1Steven G. Kargl
14 Jan 25 `* Re: nasty link problem with Gfortran and G++ (C++) ???4Lynn McGuire
14 Jan 25  `* Re: nasty link problem with Gfortran and G++ (C++) ???3Thomas Koenig
15 Jan 25   `* Re: nasty link problem with Gfortran and G++ (C++) ???2Lynn McGuire
15 Jan 25    `- Re: nasty link problem with Gfortran and G++ (C++) ???1Thomas Koenig

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal