Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29274 Discussions

mixed language programming ifc g++ and the -Vaxlib option

nmtanim
Beginner
693 Views
I am compiling a mixed language program. The fortran subroutine uses the
function rand() and can be called succesfully from a fortran subroutine
using the linker option of ifc -Vaxlib. But I need to call the Fortran
subroutine from a C++ function and the linker used is g++. I have tried
linking with the library -lPEPCF90 but it complains the following

/lusr/share/software/intel/compiler70/ia32/lib/libPEPCF90.so.3: undefined
reference to `INTELf90_dclock'

Can anyone tell me how to link properly with the fortran subroutine that
uses rand(). Thanks
FYI: I can link between g++ and ifc when I am not using the rand funtion in the fortran subroutine. The libraries that I am linking using g++ are the following (I added the -lPEPCF90 after the rand() function was added in the fortran subroutine)
-L/usr/X11R6/lib -lX11 -L/lusr/share/software/intel/compiler70/ia32/lib -lIEPCF90 -lF90 -lPEPCF90 -lm -lpthread


0 Kudos
3 Replies
nmtanim
Beginner
693 Views
I forgot to mention that the ifc version I am using is version 7.1 and g++ version is 3.0.3. And I have to use g++ as the linker.
0 Kudos
TimP
Honored Contributor III
693 Views
In case you may have missed them, here are some hints:
You can find out the options which ifc would pass to ld by:
ifc -# -Vaxlib *.f...
or you can run nm on the .a files in the Intel compiler /lib directory, to find out which libraries define rand. It looks like you are on the right track, if you require the use of g++ to drive ld, you will have to add the appropriate -l references for the ifc libraries. These will be entirely different with 7.1 from what they are in the current compilers.
When mixing Intel Fortran with g++, you are likely to run into such problems. Either you use Fortran to link, and add -lstdc++, or you use g++ to link and figure out which Fortran libraries are required. 8.x compilers have a higher degree of compatibility with g++, but that doesn't appear to be relevant to your question.
If you wished to write portable Fortran, you might be using standard Fortran rather than -Vaxlib RNG. That might change the required selection of libraries.
0 Kudos
nmtanim
Beginner
693 Views
Thanks a lot. The -# option gave me enough information. Thanks again.
0 Kudos
Reply