- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Steve,
I am using Visual Fortran V.9 with Visual Studio 2005.
Got link error for C call to a Fortran routine
and no link error for Fortran call to a C routine even though there is no C routine called.
It seems that there were no communications between C-side and Fortran library side.
The two files are at the end of this message.
Actually, I made the simple example using Compaq Fortran and Visual C++ v.6 and converted it into two parts (: proj and proj_lib) under one solution using Visual Fortran V.9 with Visual Studio 2005.
C part into proj and Fortran part into proj_lib as a static library.
I got link error:
error LNK2019: unresolved external symbol _mainprog referenced in function _WinMain@16
It worked before the break up into two parts with Compaq and VC++ v.6.
Thanks.
-K. Hong
Fortran-file f1.f
subroutine mainprog( )
!DEC$ ATTRIBUTES C :: mainprog&nbs p;
interface
subroutine f2c(n1)
!DEC$ ATTRIBUTES C :: f2c
integer n1
end subroutine
end interface
n=10
call f2c(n)
return
end
C-file c1.c
#include "stdafx.h"
extern void mainprog(void);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
mainprog();
return 0;
}
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
I amdpwnloadingthe SP1.
In the mean time, I followed your advice. However,
I could not make the Fortran project is a dependent of the C++ project.
I got "circular dependency" warning.
For some reason, I could do the other way only
even though I made C side main and Fortran side static.
Any idea?
Thanks.
-K. Hong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Steve,
Here are the steps taken so far:
1. Double click the existing workspace of VC++ v.6.
2. Yes to allto "Convert and open this project?"
3. I got one project under one solution.
4. In the source file, I had f1.f and c1.c
5. Right clicked on the project and selected Extract Compaq Fortran Project Items
6. I chose The Visual C++ project at the question Select the project that will be the main project. Then OK.
7. Now I got a new Fortran static library project proj_lib.
8. Set the dependencies by right mouse click on Fortran static project or C-proj.
9. I get an error regardless of the dependency.
(a) Fortran depends on C : can not file ifconsol.lib
(b) C depends on Fortran: unresolved error for a Fortran function call from C.
Thanks.
-K. Hong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've just sent the report to Premium Support with my project files uploaded.
-K. Hong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Steve,
Are you working on the problem?
Please let me know?
-K.Hong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The sample you sent me did not show a problem, but it was different from what you described here.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page