- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm to create a solution with 2 projects: a Fortran DLL, and a Fortran application which uses functions within that DLL. I've created a simple example to get myself started, but am having trouble linking with the DLL. My build environment is as follows:
Windows XP x64 (SP2)
Visual Studio 2005 (SP1)
Intel Visual Fortran 9.1
Building for x64 platform
Here's the steps I have taken:
-- Created new solution with Intel Fortran DLL project
-- Added new source file:
MODULE DLL_MOD
CONTAINS
SUBROUTINE DLL_PRINT(x)
!DEC$ ATTRIBUTES DLLEXPORT :: DLL_PRINT
INTEGER :: x
WRITE(*,*) x
RETURN
END SUBROUTINE DLL_PRINT
ENDMODULE DLL_MOD
-- Create new Fortran Application project inside current solution
-- Add DLL project as a dependency of new project
-- Add new source file to new project:
error LNK2019: unresolved external symbol __imp__DLL_MOD_mp_DLL_PRINT referenced in function MAIN__
Using the dumpbin utility, I can see the symbol is being exported. It seems, though, that it is exported under the name "DLL_MOD_mp_DLL_PRINT", but the application is looking for the symbol with a "__imp__" prefix. Does anyone know what the problem could be? I hope I have been thorough enough.
Windows XP x64 (SP2)
Visual Studio 2005 (SP1)
Intel Visual Fortran 9.1
Building for x64 platform
Here's the steps I have taken:
-- Created new solution with Intel Fortran DLL project
-- Added new source file:
MODULE DLL_MOD
CONTAINS
SUBROUTINE DLL_PRINT(x)
!DEC$ ATTRIBUTES DLLEXPORT :: DLL_PRINT
INTEGER :: x
WRITE(*,*) x
RETURN
END SUBROUTINE DLL_PRINT
ENDMODULE DLL_MOD
-- Create new Fortran Application project inside current solution
-- Add DLL project as a dependency of new project
-- Add new source file to new project:
PROGRAM EXE_TEST
USE DLL_MOD
IMPLICIT NONE
INTEGER :: a = 1
CALL DLL_PRINT(a)
END PROGRAM EXE_TEST
-- In the project settings of the new project, add the output directory of the DLL project under Fortran > General > Additional Include Directories (this resolved compiler error looking for mod file).
-- In the Configuration Manager, create new solution platform for "x64", creating and selecting new platforms for projects as well.
-- In Tools > Options > Intel Fortran > General, select "x64" under "Target Platform"
When I try to build with this setup, I can build the DLL project, but the application project receives a linking error:error LNK2019: unresolved external symbol __imp__DLL_MOD_mp_DLL_PRINT referenced in function MAIN__
Using the dumpbin utility, I can see the symbol is being exported. It seems, though, that it is exported under the name "DLL_MOD_mp_DLL_PRINT", but the application is looking for the symbol with a "__imp__" prefix. Does anyone know what the problem could be? I hope I have been thorough enough.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've resolved this on my own, although I'm not sure where the problem was exactly...
Previously I had installed a trial version of the Visual Fortran 10.0.026 compiler, which was integrated side-by-side with 9.1 in Visual Studio 2005. I uninstalled both compilers, and re-installed an updated version of 9.1. After that everything built just fine.
Previously I had installed a trial version of the Visual Fortran 10.0.026 compiler, which was integrated side-by-side with 9.1 in Visual Studio 2005. I uninstalled both compilers, and re-installed an updated version of 9.1. After that everything built just fine.

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