Home > Archive > Fortran > April 2006 > linking gfortran with VC++.net
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
linking gfortran with VC++.net
|
|
| J. Weeks 2006-04-17, 7:03 pm |
| I am trying to call some fortran code from an application written in C
and C++ and built using VC++.net. I am using gfortran as my fortran
compiler, and building a library containing my compiled fortran code. I
use MinGW's ar and ranlib tools to build the library.
In VC++.net, I simply include the libary files in my project. As long
as the library is named "whatever.lib" I can link routines from the
library, so that's OK. But I also need the gfortran fortran libraries
to link into my application. They seem to be all *.a files. I don't
really like the idea of messing with the gfortran distribution, but I
changed libgfortran.a to libgfortran.lib, and some of my unresolved
symbols went away, but new ones appeared...
Clearly, I need a better solution to the libraries.
1) Is gfortran the wrong solution?
2) Is there some installation option that I need to apply to gfortran?
3) Other hints that I haven't thought of?
Thanks in advance!
| |
| Tim Prince 2006-04-18, 4:03 am |
| J. W s wrote:
> I am trying to call some fortran code from an application written in C
> and C++ and built using VC++.net. I am using gfortran as my fortran
> compiler, and building a library containing my compiled fortran code. I
> use MinGW's ar and ranlib tools to build the library.
>
> In VC++.net, I simply include the libary files in my project. As long
> as the library is named "whatever.lib" I can link routines from the
> library, so that's OK. But I also need the gfortran fortran libraries
> to link into my application. They seem to be all *.a files. I don't
> really like the idea of messing with the gfortran distribution, but I
> changed libgfortran.a to libgfortran.lib, and some of my unresolved
> symbols went away, but new ones appeared...
>
> Clearly, I need a better solution to the libraries.
>
> 1) Is gfortran the wrong solution?
>
> 2) Is there some installation option that I need to apply to gfortran?
>
> 3) Other hints that I haven't thought of?
You're departing from the beaten path in so many ways, without giving
many specifics about what you are doing. Evidently, Mingw gfortran is
meant to work with Mingw gcc and g++, and cygwin gfortran with cygwin
gcc/g++. If you have a reason for trying totally unsupported
combinations, start with trivial examples, and learn what works and what
doesn't. Assuming you're running 32 bit Windows, which you didn't say,
there isn't necessarily a difference between a .lib and a .a file. If
you had given actual error messages, it might be evident whether you
forgot that the default for gfortran is to use lower case linkage
symbols with '_' appended.
|
|
|
|
|