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

Linking OBJ and DLL to a Intel Visual Fortran project

jirina
New Contributor I
1,067 Views
Hello,

I am trying to rewrite a code from (Open) Watcom Fortran 77 to Intel Visual Fortran (I use Microsoft Visual Studio 2008 as the IDE). After a few minor changes, I was able to compile all files - IVF can easily handle Fortran 77 code mixed with Fortran 95 syntax which I had to add.

However, the real problem comes with linking. There are two issues which I (as a newbie) am not able to resolve even after going through various forums and help files:

1. I have a DLL created written in C++ using Visual Studio .NET; it contains some functions to write into the system event log, so it is not using any allocations or I/O operations. It was very easy to just add this DLL to the Open Watcom Fortran (OWF) project and the linker handled it automatically using wlib meaning Watcom Library Manager. How do I link the DLL in IVF? Is there any easy way or any tutorial dealing with this? Adding the DLL to the Solution Explorer in Visual Studio is obviously not the right way. I should mention that I have the DLL in the same project directory as all the .for source files.

2. I have several OBJs which are quite old, I don't know where they are coming from and I don't have the corresponding source code anymore. They might have been created using Visual C++ 6.0 or Watcom Fortran 77. Once again, just adding the OBJ files to the OWF project was the only thing to be done for the linker to link them. Trying the same in IVF gives me an error "fatal error LNK1107: invalid or corrupt file: cannot read at ...". Is there anything I can try to link these OBJs? If not, I would have to rewrite all methods/functions included in them (after finding out what they are supposed to do).

Thank you in advance for any suggestions, ideas or advice.
0 Kudos
2 Replies
g_f_thomas
Beginner
1,067 Views

1. Dynamically. Usually your exe loads the module (dll) because it invokes one of its exports.

2. I'd say you're out of luck if you don't have the source. Arbitrary .obj's can't be linked to anything other than to those of similar ilk. You'll have to rewrite them I'm afraid.

Gerry

0 Kudos
jirina
New Contributor I
1,067 Views
Thank you for your reply. Fortunately, I can replace some subroutines from OBJ files by what is available in IVF; I will have to write the rest from scratch.

As for the DLL problem, I realized that it is rather a problem of calling functions from the DLL than a problem of linking the DLL.
0 Kudos
Reply