Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
1 View

Unable to link FORTRAN x64 DLL

Jump to solution

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

Accepted Solutions
Highlighted
1 View

I expect to see the /DLL

Jump to solution

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.

Retired 12/31/2016

View solution in original post

0 Kudos
5 Replies
Highlighted
1 View

How did you do this "upgrade"

Jump to solution

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.

Retired 12/31/2016
0 Kudos
Highlighted
Beginner
1 View

<?xml version="1.0" encoding=

Jump to solution
<?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
Highlighted
Beginner
1 View

We are building the x64/x64

Jump to solution

We are building the x64/x64 configuration.

0 Kudos
Highlighted
2 Views

I expect to see the /DLL

Jump to solution

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.

Retired 12/31/2016

View solution in original post

0 Kudos
Highlighted
Beginner
1 View

Adding the /DLL to the linker

Jump to solution

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