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

Unable to link FORTRAN x64 DLL

Robert_T_2
Beginner
546 Views

We have build many FORTRAN x32 DLL's utilizing VS2008 and Intel(R) Visual Fortran 11.1.038.

When we try "upgrade" to x64 we always get the following error when attempting to build:

 Build Log  

     Build started: Project: test, Configuration: x64|x64 

 

 Output  

    Compiling with Intel(R) Visual Fortran 11.1.038 [Intel(R) 64]...
ifort /nologo /iface:cvf /module:"x64\x64\\" /object:"x64\x64\\" /libs:static /threads /c /Qvc9 /Qlocation,link,"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64" "E:\AST_SOFT\Soft_dev\Solid\UniGr\UG_Nuform\test\UG_NUFORM_DLL.for"
Compiling manifest to resources...
rc.exe /fo "E:\AST_SOFT\Soft_dev\Solid\UniGr\UG_Nuform\test\x64\x64\test.dll.embed.manifest.res" "E:\AST_SOFT\Soft_dev\Solid\UniGr\UG_Nuform\test\x64\x64\test.dll.embed.manifest.rc"
Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
Copyright (C) Microsoft Corporation.  All rights reserved.

Linking...
Link /OUT:"x64\x64\test.dll" /NOLOGO /MANIFEST /MANIFESTFILE:"E:\AST_SOFT\Soft_dev\Solid\UniGr\UG_Nuform\test\x64\x64\test.dll.intermediate.manifest" /IMPLIB:"E:\AST_SOFT\Soft_dev\Solid\UniGr\UG_Nuform\test\x64\x64\test.lib" "x64\x64\UG_NUFORM_DLL.obj" "E:\AST_SOFT\Soft_dev\Solid\UniGr\UG_Nuform\test\x64\x64\test.dll.embed.manifest.res"
Link: executing 'link'
   Creating library E:\AST_SOFT\Soft_dev\Solid\UniGr\UG_Nuform\test\x64\x64\test.lib and object E:\AST_SOFT\Soft_dev\Solid\UniGr\UG_Nuform\test\x64\x64\test.exp
libifcoremt.lib(for_main.obj) : error LNK2019: unresolved external symbol MAIN__ referenced in function main
x64\x64\test.dll : fatal error LNK1120: 1 unresolved externals


test - 2 error(s), 0 warning(s)

 
The following is the simple subroutine that is the sole member of the project/DLL:
	Subroutine  UG_NUFORM_DLL [dllexport] (ArgsIn) 
!DEC$ ATTRIBUTES ALIAS:'UG_NUFORM_DLL' :: UG_NUFORM_DLL
!DEC$ ATTRIBUTES STDCALL :: UG_NUFORM_DLL
!DEC$ ATTRIBUTES REFERENCE :: ArgsIn
C
C	(c) A. S. Thomas, Inc.  2006
C	    All rights reserved.
C
C	=======================================================
C
C		The program translates UG file into 
C			LEVEL I and	LEVEL II outputs
C
C	=======================================================

	IMPLICIT NONE
!
	character*256 ArgsIn
!
	character*256 command_line
	common /cmd_line/command_line
!
!===================================================================================
!====================================================================================

	command_line=ArgsIn
	return
C
	END

This test DLL builds when built using x86..  What is necessary to get a working DLL?

0 Kudos
1 Solution
Steven_L_Intel1
Employee
546 Views

I expect to see the /DLL option in the link command, but it's not there. I don't see anything obvious in the project file you posted (though I did ask for it to be attached as a file.) If I take this project file it builds fine with VS2008 and the oldest compiler I have, 12.1.

All I can suggest is to add /DLL to Linker > Command Line > Additional Options and see what happens. I see that this project references a separate library - what happens if you remove that from the Linker > Input property page? (Since it doesn't seem to be used.) I doubt this makes a difference, however.

View solution in original post

0 Kudos
5 Replies
Steven_L_Intel1
Employee
546 Views

How did you do this "upgrade"? It looks to me as if the project is not set as a DLL project type. Please attach the .vfproj file from this project so I can see what the project settings are.

0 Kudos
Robert_T_2
Beginner
546 Views
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject ProjectType="typeDynamicLibrary" ProjectCreator="Intel Fortran" Keyword="Dll" Version="11.0" ProjectIdGuid="{B322A008-C53D-4854-80C0-5EE106ED94EE}">
	<Platforms>
		<Platform Name="Win32"/>
		<Platform Name="x64"/></Platforms>
	<Configurations>
		<Configuration Name="Debug|Win32" ConfigurationType="typeDynamicLibrary">
				<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" Interfaces="true" WarnInterfaces="true" CallingConvention="callConventionCVF" Traceback="true" BoundsCheck="true" RuntimeLibrary="rtMultiThreadedDebugDLL"/>
				<Tool Name="VFLinkerTool" SuppressStartupBanner="true" GenerateDebugInformation="true" SubSystem="subSystemWindows" LinkDLL="true" AdditionalDependencies="$(AST_SOFT)\soft_image\string_dec\release\string_dec.lib"/>
				<Tool Name="VFResourceCompilerTool"/>
				<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
				<Tool Name="VFCustomBuildTool"/>
				<Tool Name="VFPreLinkEventTool"/>
				<Tool Name="VFPreBuildEventTool"/>
				<Tool Name="VFPostBuildEventTool"/>
				<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
		<Configuration Name="Release|Win32" ConfigurationType="typeDynamicLibrary">
				<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" RuntimeLibrary="rtMultiThreadedDLL"/>
				<Tool Name="VFLinkerTool" SuppressStartupBanner="true" SubSystem="subSystemWindows" LinkDLL="true"/>
				<Tool Name="VFResourceCompilerTool"/>
				<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
				<Tool Name="VFCustomBuildTool"/>
				<Tool Name="VFPreLinkEventTool"/>
				<Tool Name="VFPreBuildEventTool"/>
				<Tool Name="VFPostBuildEventTool"/>
				<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
		<Configuration Name="x64|Win32" ConfigurationType="typeDynamicLibrary">
				<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" CallingConvention="callConventionCVF"/>
				<Tool Name="VFLinkerTool" SuppressStartupBanner="true" AdditionalDependencies="$(AST_SOFT)\soft_image\string_dec\x64\string_dec.lib"/>
				<Tool Name="VFResourceCompilerTool"/>
				<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
				<Tool Name="VFCustomBuildTool"/>
				<Tool Name="VFPreLinkEventTool"/>
				<Tool Name="VFPreBuildEventTool"/>
				<Tool Name="VFPostBuildEventTool"/>
				<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
		<Configuration Name="Debug|x64" ConfigurationType="typeDynamicLibrary">
				<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" Interfaces="true" WarnInterfaces="true" CallingConvention="callConventionCVF" Traceback="true" BoundsCheck="true" RuntimeLibrary="rtMultiThreadedDebugDLL"/>
				<Tool Name="VFLinkerTool" SuppressStartupBanner="true" GenerateDebugInformation="true" SubSystem="subSystemWindows" LinkDLL="true" AdditionalDependencies="$(AST_SOFT)\soft_image\string_dec\release\string_dec.lib"/>
				<Tool Name="VFResourceCompilerTool"/>
				<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
				<Tool Name="VFCustomBuildTool"/>
				<Tool Name="VFPreLinkEventTool"/>
				<Tool Name="VFPreBuildEventTool"/>
				<Tool Name="VFPostBuildEventTool"/>
				<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
		<Configuration Name="Release|x64" ConfigurationType="typeDynamicLibrary">
				<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" RuntimeLibrary="rtMultiThreadedDLL"/>
				<Tool Name="VFLinkerTool" SuppressStartupBanner="true" SubSystem="subSystemWindows" LinkDLL="true"/>
				<Tool Name="VFResourceCompilerTool"/>
				<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
				<Tool Name="VFCustomBuildTool"/>
				<Tool Name="VFPreLinkEventTool"/>
				<Tool Name="VFPreBuildEventTool"/>
				<Tool Name="VFPostBuildEventTool"/>
				<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
		<Configuration Name="x64|x64" ConfigurationType="typeDynamicLibrary">
				<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" CallingConvention="callConventionCVF"/>
				<Tool Name="VFLinkerTool" SuppressStartupBanner="true"/>
				<Tool Name="VFResourceCompilerTool"/>
				<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
				<Tool Name="VFCustomBuildTool"/>
				<Tool Name="VFPreLinkEventTool"/>
				<Tool Name="VFPreBuildEventTool"/>
				<Tool Name="VFPostBuildEventTool"/>
				<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration></Configurations>
	<Files>
		<Filter Name="Header Files" Filter="fi;fd"/>
		<Filter Name="Resource Files" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"/>
		<Filter Name="Source Files" Filter="f90;for;f;fpp;ftn;def;odl;idl">
		<File RelativePath=".\UG_NUFORM_DLL.for"/></Filter></Files>
	<Globals/></VisualStudioProject>

 

0 Kudos
Robert_T_2
Beginner
546 Views

We are building the x64/x64 configuration.

0 Kudos
Steven_L_Intel1
Employee
547 Views

I expect to see the /DLL option in the link command, but it's not there. I don't see anything obvious in the project file you posted (though I did ask for it to be attached as a file.) If I take this project file it builds fine with VS2008 and the oldest compiler I have, 12.1.

All I can suggest is to add /DLL to Linker > Command Line > Additional Options and see what happens. I see that this project references a separate library - what happens if you remove that from the Linker > Input property page? (Since it doesn't seem to be used.) I doubt this makes a difference, however.

0 Kudos
Robert_T_2
Beginner
546 Views

Adding the /DLL to the linker command line solved the problem for building the x64 variant.  We are surprised that such is present in the x86 variant.

Thank you

0 Kudos
Reply