Lahey Support
08-15-2003, 01:33 AM
I would like to know how one would go about, if it is possible, linking a
FORTRAN subroutine into a Microsoft Developer Studio (C++) project.
From the manual, I was able to glean that I should compile the FORTRAN
like so:
lf95 -c -staticlink -ml msvc foo.for
If I do this (and if foo.for contains SUBROUTINE FOOBAR), I get a link
error in Developer Studio:
Linking...
testView.obj : error LNK2001: unresolved external symbol "void __cdecl
FOOBAR(int)" [address removed]
Release/test.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
LNK2001 is long and involved. Suffice it to say that there are many
possibilities why I am getting this error. I have tried using an 'extern'
statement, and various calling conventions (__stdcall and __cdecl) for
both the 'extern void FOOBAR' and the MSDev C++ project files. Nothing
works.
Could the problem be that the foo.obj file is 16 bit (by default) and the
MSDev project is 32 bit? This is a possibility that LNK2001 mentions. I
have tried creating .dll's and .lib's, but I still get the same problem.
Bill Tangren
----------------------------------------------------------
To unsubscribe, send to [address removed] the following
as the first and only line of the message body:
unsubscribe fortran
----------------------------------------------------------
FORTRAN subroutine into a Microsoft Developer Studio (C++) project.
From the manual, I was able to glean that I should compile the FORTRAN
like so:
lf95 -c -staticlink -ml msvc foo.for
If I do this (and if foo.for contains SUBROUTINE FOOBAR), I get a link
error in Developer Studio:
Linking...
testView.obj : error LNK2001: unresolved external symbol "void __cdecl
FOOBAR(int)" [address removed]
Release/test.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
LNK2001 is long and involved. Suffice it to say that there are many
possibilities why I am getting this error. I have tried using an 'extern'
statement, and various calling conventions (__stdcall and __cdecl) for
both the 'extern void FOOBAR' and the MSDev C++ project files. Nothing
works.
Could the problem be that the foo.obj file is 16 bit (by default) and the
MSDev project is 32 bit? This is a possibility that LNK2001 mentions. I
have tried creating .dll's and .lib's, but I still get the same problem.
Bill Tangren
----------------------------------------------------------
To unsubscribe, send to [address removed] the following
as the first and only line of the message body:
unsubscribe fortran
----------------------------------------------------------