Re: linking g95-built library from VC++
- From: "Matthew Halfant" <halfant@xxxxxxx>
- Date: Fri, 30 Jun 2006 07:06:26 GMT
I've done a little more experimenting, and gotten it to work by the simple
device of explicitly placing LIBC.lib on the command line in front of
msvcrt.lib:
cl caller.c fortlib.lib f95.lib gcc.lib LIBC.lib msvcrt.lib
That produces the warning messages:
LINK : warning LNK4089: all references to "dkxh.o" discarded by /OPT:REF
LINK : warning LNK4089: all references to "dkxs00060.o" discarded by
/OPT:REF
but the application appears to run correctly.
I noticed that msvcrt.lib can be found amoung the VC++ libraries, and that I
can omit copying it from the GNU libararies. Either seems to work, and both
result in the warning messages shown above.
I'd still be grateful for instruction from anyone who actually knows the
correct way to go about this.
"Matthew Halfant" <halfant@xxxxxxx> wrote in message
news:O90pg.363$cd3.193@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I've built a library of Fortran 95 functions using g95 on Win2k, and
my colleagues at work need to statically link to it from Microsoft
VC++. I seem to be making progress, but don't really know what I'm
doing, and am hoping that someone has worked through these issues and
can advise.
I'm building the library with
g95 -O3 -c foo_1.f90
g95 -O3 -c foo_2.f90
...
ren *.o *.obj
lib /out:fortlib.lib *.obj
The C interface is caller.c and I'm trying to use cl (VC++ C Compiler)
to build the final executable. Toward that end I copy libf95.a and
libgcc.a as .lib files:
copy libf95.a f95.lib
copy libgcc.a gcc.lib
cl caller.c fortlib.lib f95.lib gcc.lib
The link stage reports the following error:
f95.lib(environ.o) : error LNK2001: unresolved external symbol
___p__environ
I tried to remedy this by including also the GNU library libmsvcrt.a,
copied to the name msvcrt.lib:
cl caller.c fortlib.lib f95.lib gcc.lib msvcrt.lib
This now produces the complaint:
LIBC.lib(crt0dat.obj) : error LNK2005: _exit already defined in
msvcrt.lib(dkxs00554.o)
LIBC.lib(strchr.obj) : error LNK2005: _strchr already defined in
msvcrt.lib(dkxs00664.o)
caller.exe : fatal error LNK1169: one or more multiply defined symbols
found
Any suggestions?
Thanks,
Matthew
.
- Follow-Ups:
- Re: linking g95-built library from VC++
- From: Jugoslav Dujic
- Re: linking g95-built library from VC++
- References:
- linking g95-built library from VC++
- From: Matthew Halfant
- linking g95-built library from VC++
- Prev by Date: Re: Random Numbers
- Next by Date: pass several filenames to the subroutine
- Previous by thread: linking g95-built library from VC++
- Next by thread: Re: linking g95-built library from VC++
- Index(es):
Relevant Pages
|
|