simple question

Mathew Yeates myeates@jpl.nasa.gov
Tue Oct 17 21:54:00 GMT 2006


Well, over on mingw I found that I can't link in crt2.o. Now I'm back to 
crashing when I write to stdout!! lol.

For posterity, here is what I've done (prior to giving up)
foo.f
      subroutine foo(n)
      integer*4 n
      n=2
      n= n + 123
       write(6,*) 'Hello'
      end

gfortran -c foo.f

main.c
extern void foo_(long *);
main() {
    long i=4;
    foo_(&i);
}
cl main.c foo.o -o main.exe [+all gfortran libraries except msvcr] libc.lib
libgfortran.a(environ.o) : warning LNK4217: locally defined symbol 
__pctype impo
rted in function _init_mem
libgfortran.a(environ.o) : warning LNK4217: locally defined symbol 
___mb_cur_max
 imported in function _init_mem
libgfortran.a(unix.o) : warning LNK4217: locally defined symbol __iob 
imported i
n function __gfortrani_flush_if_preconnected

run main.exe and crash!

Mathew

FX Coudert wrote:
>> libmingw32.a(pseudo-reloc.o) : error LNK2019: unresolved external 
>> symbol __image_base__ referenced in function __pei386_runtime_relocator
>> main.exe : fatal error LNK1120: 1 unresolved externals
>>
>> Where is image_base? Is it impossible to link using cl.exe?
>
> No idea, and no idea.
>
> But it looks more like a general mingw question, so you might want to 
> direct it to the appropriate mingw mailing-list.
>
> Sorry,
> FX
>




More information about the Fortran mailing list