- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
i have problems integrating C-static libs into a Fortran
Application. In the Fortran Code are several functions referenced.
For example:
...
integer, external :: pfopen
...
File%unit = pfopen(n_name, File%name, File%mode)
...
These functions are located in the C-static library (PACT-PDB, http://pact.llnl.gov ). I have compiled the PACT-PDB and got several .lib files:
panacea.lib pdb.lib pgs.lib pml.lib ppc.lib scheme.lib scorelib sx.lib
If i specify these libs under "Linker->Additional Dependencies" i still get the following link errors:
-----------------------<
------ Build started: Project: flmnav, Configuration: Debug|Win32 ------
Linking...
Link /OUT:"Debug/flmnav.exe" /INCREMENTAL /NOLOGO /LIBPATH:"C:1_UserchristianTUMDAvs_flmnavpactpactworkpactdevwinnt4.0lib" /NODEFAULTLIB:"libcmtd.lib" /DEBUG /PDB:"Debug/flmnav.pdb" /SUBSYSTEM:CONSOLE panacea.lib pdb.lib pgs.lib pml.lib ppc.lib scheme.lib score.lib sx.lib /C90
Debug/error.obj Debug/get_cpu_time.obj Debug/halt.obj Debug/hp_cpu_time.obj Debug/ijk_l123.obj Debug/l123_ijk.obj Debug/asics.obj Debug/filemod.obj
...
...
Debug/write_body.obj Debug/write_coeff.obj Debug/write_coeff_n.obj Debug/write_conv2.obj Debug/write_surf.obj Debug/wrparam.obj Debug/wrqnf_flow.obj Debug/wrqntecu_time.obj Debug/wrseglog.obj Debug/wrsurf_pdb.obj
Link: executing 'link'
LINK : warning LNK4044: unrecognized option '/C90'; ignored
filemod.obj : error LNK2019: unresolved external symbol _PFOPEN referenced in function _FILEMOD..OPEN_FILE
filemod.obj : error LNK2019: unresolved external symbol _PFCLOS referenced in function _FILEMOD..CLOSE_FILE
wrsurf_pdb.obj : error LNK2001: unresolved external symbol _PFGERR
filemod.obj : error LNK2019: unresolved external symbol _PFGERR referenced in function _FILEMOD..CLOSE_FILE
dbmmod.obj : error LNK2019: unresolved external symbol _PFGERR referenced in function _DBMMOD..WRPDB_DBM
...
...
Debug/flmnav.exe : fatal error LNK1120: 19 unresolved externals
flmnav build failed.
-----------------------<
I am using Visual Studio.Net 2003, Intel C++ 7.1 and Intel Fortran 7.1 (all for Windows).
Can anyone help me get out of this problem ?
Thanks in advantage,
Christian
i have problems integrating C-static libs into a Fortran
Application. In the Fortran Code are several functions referenced.
For example:
...
integer, external :: pfopen
...
File%unit = pfopen(n_name, File%name, File%mode)
...
These functions are located in the C-static library (PACT-PDB, http://pact.llnl.gov ). I have compiled the PACT-PDB and got several .lib files:
panacea.lib pdb.lib pgs.lib pml.lib ppc.lib scheme.lib scorelib sx.lib
If i specify these libs under "Linker->Additional Dependencies" i still get the following link errors:
-----------------------<
------ Build started: Project: flmnav, Configuration: Debug|Win32 ------
Linking...
Link /OUT:"Debug/flmnav.exe" /INCREMENTAL /NOLOGO /LIBPATH:"C:1_UserchristianTUMDAvs_flmnavpactpactworkpactdevwinnt4.0lib" /NODEFAULTLIB:"libcmtd.lib" /DEBUG /PDB:"Debug/flmnav.pdb" /SUBSYSTEM:CONSOLE panacea.lib pdb.lib pgs.lib pml.lib ppc.lib scheme.lib score.lib sx.lib /C90
Debug/error.obj Debug/get_cpu_time.obj Debug/halt.obj Debug/hp_cpu_time.obj Debug/ijk_l123.obj Debug/l123_ijk.obj Debug/asics.obj Debug/filemod.obj
...
...
Debug/write_body.obj Debug/write_coeff.obj Debug/write_coeff_n.obj Debug/write_conv2.obj Debug/write_surf.obj Debug/wrparam.obj Debug/wrqnf_flow.obj Debug/wrqntecu_time.obj Debug/wrseglog.obj Debug/wrsurf_pdb.obj
Link: executing 'link'
LINK : warning LNK4044: unrecognized option '/C90'; ignored
filemod.obj : error LNK2019: unresolved external symbol _PFOPEN referenced in function _FILEMOD..OPEN_FILE
filemod.obj : error LNK2019: unresolved external symbol _PFCLOS referenced in function _FILEMOD..CLOSE_FILE
wrsurf_pdb.obj : error LNK2001: unresolved external symbol _PFGERR
filemod.obj : error LNK2019: unresolved external symbol _PFGERR referenced in function _FILEMOD..CLOSE_FILE
dbmmod.obj : error LNK2019: unresolved external symbol _PFGERR referenced in function _DBMMOD..WRPDB_DBM
...
...
Debug/flmnav.exe : fatal error LNK1120: 19 unresolved externals
flmnav build failed.
-----------------------<
I am using Visual Studio.Net 2003, Intel C++ 7.1 and Intel Fortran 7.1 (all for Windows).
Can anyone help me get out of this problem ?
Thanks in advantage,
Christian
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can't find the description of these routines on the PACT web site. I'm wondering if the library assumes that C and Fortran use the same calling conventions. If these are C routines, Fortran is upcasing the names whereas C would leave the case alone.
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve,
the libraries do work together with fortran. We have them already compiled on UNIX,Linux and VPP(Hitachi). They're simply named in the linker's parameter list. Here's the documentation for PACT usage withing Fortran under Linux:
-->
Usage of PACT on the IA32 Linux Cluster
The PACT root directory (denoted as $PACTROOT in the following) is /usr/local/sys/lib/pact. You will need to set the following environment variables.
export PATH=/usr/local/sys/lib/pact/bin:$PATH
export SCHEME=/usr/local/sys/lib/pact/scheme
export ULTRA=/usr/local/sys/lib/pact/scheme
For building applications please add the include path
icc -c ... -I$PACTROOT/include foo.c
to the C Compiler call, and for linkage (some or all of) the PACT libraries are required:
icc -o myprog ... -L$PACTROOT/lib -lpanacea -lpdb -lpgs -lpml -lppc -lpsmm -lscheme -lscore -lsx
If you need to link in PACT libraries with the Fortran Compiler, please use the command line
efc -Vaxlib -o myprog ... -L$PACTROOT/lib -lpanacea -lpdb -lpgs -lpml -lppc -lpsmm -lscheme -lscore -lsx
--<
In the file "PDFIA.C", the Fortran interface functions are defined.
Under Windows (XP), i've tried alot of compiler-settings within Visual Studio.Net, but it's still stating that link error.
Christian
the libraries do work together with fortran. We have them already compiled on UNIX,Linux and VPP(Hitachi). They're simply named in the linker's parameter list. Here's the documentation for PACT usage withing Fortran under Linux:
-->
Usage of PACT on the IA32 Linux Cluster
The PACT root directory (denoted as $PACTROOT in the following) is /usr/local/sys/lib/pact. You will need to set the following environment variables.
export PATH=/usr/local/sys/lib/pact/bin:$PATH
export SCHEME=/usr/local/sys/lib/pact/scheme
export ULTRA=/usr/local/sys/lib/pact/scheme
For building applications please add the include path
icc -c ... -I$PACTROOT/include foo.c
to the C Compiler call, and for linkage (some or all of) the PACT libraries are required:
icc -o myprog ... -L$PACTROOT/lib -lpanacea -lpdb -lpgs -lpml -lppc -lpsmm -lscheme -lscore -lsx
If you need to link in PACT libraries with the Fortran Compiler, please use the command line
efc -Vaxlib -o myprog ... -L$PACTROOT/lib -lpanacea -lpdb -lpgs -lpml -lppc -lpsmm -lscheme -lscore -lsx
--<
In the file "PDFIA.C", the Fortran interface functions are defined.
Under Windows (XP), i've tried alot of compiler-settings within Visual Studio.Net, but it's still stating that link error.
Christian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My guess is a name mismatch. Do a:
dumpbin -symbols
on each of the libraries and look for the routine names you want. Are they uppercase or lowercase?
Steve
dumpbin -symbols
on each of the libraries and look for the routine names you want. Are they uppercase or lowercase?
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Finally, i got it working.
I had to change the "External Procedure" settings to:
External Name Interpretation: Lower Case
Append Underscore to External Names: Yes.
Thanks
Christian
I had to change the "External Procedure" settings to:
External Name Interpretation: Lower Case
Append Underscore to External Names: Yes.
Thanks
Christian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Pretty much what I thought. The C library was built assuming typical UNIX Fortran name decoration. Often there's a symbol you can define in a header to change the name construction (upcase/downcase, append underscore or no, etc.)
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Correct,
i can now build the solution without any changes to the source code.
Thank you
Christian
i can now build the solution without any changes to the source code.
Thank you
Christian
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page