- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to understand how to link a DLL, created in C, into a fortran executable. To this end I have made very simple source code given below.
The Addit library is included in the compliation of the Fortran code. When I compile and link the Fortran routine I get a linker error as follows:
Searching Libraries
Searching c:CodeTestAddItAddItDLL.lib:
Found _AddIt
Referenced in FORADD.obj
Loaded AddItDLL.lib(AddIt.dll)
c:CodeTestAddItAddItDLL.lib : fatal error LNK1106: invalid file or disk full: cannot seek to 0x3b611128
Error executing link.exe.
It appears that the procedure contained in the DLL is being found, but the linker does not like it. I have plenty of space on the disk (>20 GB). The C DLL was created using Microsoft Visual C++ 6.0.
Any thoughts?
// AddIt.cpp //
#include "Addit.h""
extern "C"
_declspec(dllexport)
void _cdecl AddIt(float A, float B, float &C)
{
C = A + B;
}
// Fortran Code //
PROGRAM MAIN
IMPLICIT NONE
INTERFACE
SUBROUTINE ADD(A,B,C)
!DEC$ ATTRIBUTES stdcall, DLLIMPORT, ALIAS:'_AddIt'::ADD
REAL*4 A,B,C
end subroutine ADD
END INTERFACE
real*4 x,y,z
x=2.0
y=3.0
z=0.0
CALL ADD(x,y,z)
END PROGRAM MAIN
The Addit library is included in the compliation of the Fortran code. When I compile and link the Fortran routine I get a linker error as follows:
Searching Libraries
Searching c:CodeTestAddItAddItDLL.lib:
Found _AddIt
Referenced in FORADD.obj
Loaded AddItDLL.lib(AddIt.dll)
c:CodeTestAddItAddItDLL.lib : fatal error LNK1106: invalid file or disk full: cannot seek to 0x3b611128
Error executing link.exe.
It appears that the procedure contained in the DLL is being found, but the linker does not like it. I have plenty of space on the disk (>20 GB). The C DLL was created using Microsoft Visual C++ 6.0.
Any thoughts?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yep - you're using a MSVC 6-created import library with a version 5 linker. MS changed the library format in an incompatible fashion. Solutions: 1) Upgrade to CVF 6.5, 2) Use the MSVC 6 linker to link, 3) Install VS97 SP3 (see the CVF FAQ for details.)
Steve
Steve
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