Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.fortran    |    Putting John Backus on a giant pedestal    |    5,127 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 4,912 of 5,127    |
|    Lynn McGuire to Thomas Koenig    |
|    Re: nasty link problem with Gfortran and    |
|    14 Jan 25 19:42:58    |
   
   From: lynnmcguire5@gmail.com   
      
   On 1/14/2025 12:42 PM, Thomas Koenig wrote:   
   > Lynn McGuire 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.   
      
   Thanks,   
   Lynn   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca