Linking to a DLL in Intel Visual Fortran 
Author Message
 Linking to a DLL in Intel Visual Fortran

Background:
I am using the Intel fortran compilter (v8.x) under microsoft visual
studio .NET, of course on a PC running XP.

I created a dynamic link library project.  I then imported from netlib
the LAPACK fortran libray into this project, and successfully compiled
it.  This of course generates .lib and  .dll files.  In my case, they
are called LAPACK.lib and LAPACK.dll

Problem:
Now, I am trying to link to the LAPACK.dll in another project - so far
without any success.  The linker tells me that it cannot find the
LAPACK routines that I am linking to.  I have tried the following:

In  "Project - Properties - Configuration Properties - Linker -
General",  I specify in the box "Additional Library Directories" the
path name of the LAPACK.lib and .dll files.

I also tried "Project - Properties - Configuration Properties - Fortran
- General"  in the box "Additional Include Directories" to add the
patch to the LAPACK.lib directory.

I have also simply copied the LAPACK.lib and LAPACK.dll files directly
into my project directory.  This still has not worked.

Can anyone give any advice as to how I should properly link to the
LAPACK dynamic link library that I've created?  Thanks!



Sat, 21 Feb 2009 01:07:11 GMT  
 Linking to a DLL in Intel Visual Fortran

Quote:

> Background:
> I am using the Intel FORTRAN compilter (v8.x) under microsoft visual
> studio .NET, of course on a PC running XP.

> I created a dynamic link library project.  I then imported from netlib
> the LAPACK fortran libray into this project, and successfully compiled
> it.  This of course generates .lib and  .dll files.  In my case, they
> are called LAPACK.lib and LAPACK.dll

> Problem:
> Now, I am trying to link to the LAPACK.dll in another project - so far
> without any success.  The linker tells me that it cannot find the
> LAPACK routines that I am linking to.  I have tried the following:

> In  "Project - Properties - Configuration Properties - Linker -
> General",  I specify in the box "Additional Library Directories" the
> path name of the LAPACK.lib and .dll files.

> I also tried "Project - Properties - Configuration Properties - Fortran
> - General"  in the box "Additional Include Directories" to add the
> patch to the LAPACK.lib directory.

> I have also simply copied the LAPACK.lib and LAPACK.dll files directly
> into my project directory.  This still has not worked.

> Can anyone give any advice as to how I should properly link to the
> LAPACK dynamic link library that I've created?  Thanks!

Add lapack.lib to the list of library files referenced by the linker --
I don't remember what the exact title for the text box is.  There may
already be a list of stuff like kernel32.lib, etc. there, in which case
you can add lapack.lib onto the end of the list.

(At least in C and C++, as I recall VC has a pragma that allows you to
insert a library reference directly into a source file -- there may be
something similar in the ifort-specific directives, although I'm not
sure that really gains you anything.)



Sat, 21 Feb 2009 04:03:12 GMT  
 Linking to a DLL in Intel Visual Fortran

Quote:

> Add lapack.lib to the list of library files referenced by the linker --
> I don't remember what the exact title for the text box is.  There may
> already be a list of stuff like kernel32.lib, etc. there, in which case
> you can add lapack.lib onto the end of the list.

> (At least in C and C++, as I recall VC has a pragma that allows you to
> insert a library reference directly into a source file -- there may be
> something similar in the ifort-specific directives, although I'm not
> sure that really gains you anything.)

This is exactly what I have been trying to find.  Unfortunatley, I've
gone through all the project properties options, and have not found an
existing list (though, you would think that there would be a standard
one there) to modify.

I am either miss-understanding what is there, or still missing the boat
on how to include these lib files.



Sat, 21 Feb 2009 04:18:29 GMT  
 Linking to a DLL in Intel Visual Fortran

Quote:

> Background:
> I am using the Intel FORTRAN compilter (v8.x) under microsoft visual
> studio .NET, of course on a PC running XP.

The best place to ask this question is the Intel Visual Fortran forum
at
http://softwareforums.intel.com/ISN/Community/en-US/forums/1005/ShowF...
.


Sat, 21 Feb 2009 06:26:21 GMT  
 Linking to a DLL in Intel Visual Fortran
|| Add lapack.lib to the list of library files referenced by the linker --
|| I don't remember what the exact title for the text box is.  There may
|| already be a list of stuff like kernel32.lib, etc. there, in which case
|| you can add lapack.lib onto the end of the list.
||
||
|| (At least in C and C++, as I recall VC has a pragma that allows you to
|| insert a library reference directly into a source file -- there may be
|| something similar in the ifort-specific directives, although I'm not
|| sure that really gains you anything.)
|
| This is exactly what I have been trying to find.  Unfortunatley, I've
| gone through all the project properties options, and have not found an
| existing list (though, you would think that there would be a standard
| one there) to modify.
|
| I am either miss-understanding what is there, or still missing the boat
| on how to include these lib files.

It's Linker/Input/Additional dependencies. Adding the library path to
the dir-list only saves you from typing the full path in that box.

(NB: If I recall correctly, the copy of the .lib within the solution
folder will be searched for before the one in "additional library
dependencies"; be aware in the case you change the library.)

--
 Jugoslav
___________
www.xeffort.com

Please reply to the newsgroup.
You can find my real e-mail on my home page above.



Sat, 21 Feb 2009 15:21:56 GMT  
 Linking to a DLL in Intel Visual Fortran

...

Quote:
> I am either miss-understanding what is there, or still missing the boat
> on how to include these lib files.

So the post title should be "Linking to a Lib..." not DLL?  Yet you
described building a .DLL project iiu in the original post...

I'm confused by the request vis a vis the concentration on the linker
and .lib files...my first thought was the problem is one is trying to
force static linking to a dynamic link???



Sat, 21 Feb 2009 22:54:54 GMT  
 Linking to a DLL in Intel Visual Fortran

Quote:


> ...

>> I am either miss-understanding what is there, or still missing the boat
>> on how to include these lib files.

> So the post title should be "Linking to a Lib..." not DLL?  Yet you
> described building a .DLL project iiu in the original post...

> I'm confused by the request vis a vis the concentration on the linker
> and .lib files...my first thought was the problem is one is trying to
> force static linking to a dynamic link???

When you build a DLL, you also get a .lib file that you can link
against, which will a) tell the linker that the functions are imported
from the DLL, and b) automagically take care of loading the DLL when the
program starts.  The OP would like to link a program that uses exported
functions from the DLL.  His description of the problem is perhaps a
little imprecise, but there was plenty enough detail for folks who are
familiar with that build system to know what was going on.

I believe that there are some compilers (don't know if any Fortran
compilers fall into this category) that can extract import information
from the DLL without the .lib file.  I presume that's not something that
can be done with ifort, though... I don't recall that it was possible
with DVF.



Sun, 22 Feb 2009 01:59:45 GMT  
 Linking to a DLL in Intel Visual Fortran
<snip>
| I believe that there are some compilers (don't know if any Fortran
| compilers fall into this category) that can extract import information
| from the DLL without the .lib file.  I presume that's not something that
| can be done with ifort, though... I don't recall that it was possible
| with DVF.

AFAIK (not that I tried) It's possible with some manual twiddling:
1) find the list of exports using dumpbin.exe or depends.exe
2) copy the list into a textual .def file in appropriate format
3) make the .lib with LIB /def

Of course, there's still "dynamic binding" (resolving references in
run-time instead of link-time), but it involves non-standard extension
(ifort/VF Cray pointers to procedures) and non-portable APIs
(LoadLibrary/GetProcAddress).

--
 Jugoslav
___________
www.xeffort.com

Please reply to the newsgroup.
You can find my real e-mail on my home page above.



Sun, 22 Feb 2009 20:30:23 GMT  
 Linking to a DLL in Intel Visual Fortran

Quote:




> <snip>
> | I believe that there are some compilers (don't know if any Fortran
> | compilers fall into this category) that can extract import information
> | from the DLL without the .lib file.  I presume that's not something that
> | can be done with ifort, though... I don't recall that it was possible
> | with DVF.

> AFAIK (not that I tried) It's possible with some manual twiddling:
> 1) find the list of exports using dumpbin.exe or depends.exe
> 2) copy the list into a textual .def file in appropriate format
> 3) make the .lib with LIB /def

I'm referring to compilers doing all of the above automagically, so that
you reference the dll and they figure out how to link to it.  I'm pretty
sure there is at least one C++ compiler that will do that.

(And then there's VB, where you give it the procedure interface and tell
it which dll to use, and it does run-time dynamic access, but that's
more like the stuff that I elided about using procedure pointers and
LoadLibrary/GetProcAddress...)



Sun, 22 Feb 2009 23:54:33 GMT  
 Linking to a DLL in Intel Visual Fortran
I've just been struggling with a similar problem, I posted a howto on
calling fortran dll's from C.
Hope it helps.
http://gjcamann-vxworks.blogspot.com/2006/10/cpp-calling-fortran-dll....


Sat, 21 Mar 2009 04:21:45 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Building DLLs with Compaq Visual Fortran and Intel Visual Fortran

2. Creating - Fortran 77 dll for use in Visual Basic 6.0 (not using Compaq Visual Fortran)

3. using Intel Visual Fortran with Visual C++ 2005 Express

4. Compaq Visual Fortran or Intel Fortran Compiler?

5. makefile from linux lahey fortran to intel visual fortran on windows

6. compag visual fortran dll callable from visual basic 6

7. Calling an FORTRAN-DLL (Visual FORTRAN/NT) from a C-program

8. DEC or Intel FORTRAN for Visual Studio 97

9. Intel Visual Fortran Professional Edition - Pricing and Upgrades

10. Intel Visual Fortran

11. Visual studio debugging of Intel Fortran works!

12. Intel Visual Fortran 9.0 MINLOC problem (sort of)

 

 
Powered by phpBB® Forum Software