- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I work on a project, where I use Fortran Code inside a COM server to call it from Matlab. I have set it up in WindowsXP (32bit), where everything worked fine. Now, I migrated the project to Windows7 (64bit) and I have trouble to register the server. The 32bit version does not work, as matlab is installed as 64bit and this version requires a 64bit COM server to work with.
The project was set up using Visual Studio 2003 and the Fortran Composer in XP. On the windows7 machine (VS2010 pro and Visual Fortran Composer XE 2011) I use a exact copy of the project, I have simply added the x64 configuration in the configuration manager, selected it and rebuild the complete project. Compiling and building the project worked fine. When I try to register the server using:
regsvr32 PROJECTPATH\x64\Release\PROJECTNAME.dll
I get an error message with code 0x80040201. I have run it under adminitrator-mode and I can register the 32bit version successfully using the same call with out the "\x64". Does anyone have an idea, what could be wrong?
Thank you,
Matthias
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
IIRC 32-bit app when executed on 64-bit Windows are subjected to hooking and redirection of their calls by WOW layer.There is also different view of registry for 32-bit app.Maybe this could be a reason of your registration problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your fast responses. I am back in the office today and now I can work on this project again.
Could you upload the VS project ( sln and proj files ) for review? Note: you don't need to upload any source files and it is needed to review all project settings
The solution file is:
[
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "Server4", "Server4\Server4.vfproj", "{36ACC53A-F0F2-4577-A9EE-98EC308953E4}"
EndProject
Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "Console1", "Console1\Console1.vfproj", "{492CE5A3-4336-4969-9893-2C4D0B4ADBEF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{36ACC53A-F0F2-4577-A9EE-98EC308953E4}.Debug|Win32.ActiveCfg = Debug|Win32
{36ACC53A-F0F2-4577-A9EE-98EC308953E4}.Debug|Win32.Build.0 = Debug|Win32
{36ACC53A-F0F2-4577-A9EE-98EC308953E4}.Debug|x64.ActiveCfg = Debug|x64
{36ACC53A-F0F2-4577-A9EE-98EC308953E4}.Debug|x64.Build.0 = Debug|x64
{36ACC53A-F0F2-4577-A9EE-98EC308953E4}.Release|Win32.ActiveCfg = Release|Win32
{36ACC53A-F0F2-4577-A9EE-98EC308953E4}.Release|Win32.Build.0 = Release|Win32
{36ACC53A-F0F2-4577-A9EE-98EC308953E4}.Release|x64.ActiveCfg = Release|x64
{36ACC53A-F0F2-4577-A9EE-98EC308953E4}.Release|x64.Build.0 = Release|x64
{492CE5A3-4336-4969-9893-2C4D0B4ADBEF}.Debug|Win32.ActiveCfg = Debug|Win32
{492CE5A3-4336-4969-9893-2C4D0B4ADBEF}.Debug|Win32.Build.0 = Debug|Win32
{492CE5A3-4336-4969-9893-2C4D0B4ADBEF}.Debug|x64.ActiveCfg = Debug|x64
{492CE5A3-4336-4969-9893-2C4D0B4ADBEF}.Debug|x64.Build.0 = Debug|x64
{492CE5A3-4336-4969-9893-2C4D0B4ADBEF}.Release|Win32.ActiveCfg = Release|Win32
{492CE5A3-4336-4969-9893-2C4D0B4ADBEF}.Release|Win32.Build.0 = Release|Win32
{492CE5A3-4336-4969-9893-2C4D0B4ADBEF}.Release|x64.ActiveCfg = Release|x64
{492CE5A3-4336-4969-9893-2C4D0B4ADBEF}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
]
and the project file (server4.vfproj) is:
[<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject ProjectType="typeDynamicLibrary" ProjectCreator="Intel Fortran" Keyword="COM Server" Version="11.0" ProjectIdGuid="{36ACC53A-F0F2-4577-A9EE-98EC308953E4}">
<Platforms>
<Platform Name="Win32"/>
<Platform Name="x64"/></Platforms>
<Configurations>
<Configuration Name="Debug|Win32" ConfigurationType="typeDynamicLibrary">
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" ParallelizerDiagLevel="parallelizerDiagLevel1" DebugParameter="debugParameterAll" WarnInterfaces="true" Interfaces="true"/>
<Tool Name="VFLinkerTool" SuppressStartupBanner="true" ModuleDefinitionFile="Server4.def" GenerateDebugInformation="true" LinkDLL="true"/>
<Tool Name="VFResourceCompilerTool" AdditionalIncludeDirectories="$(IntDir)\"/>
<Tool Name="VFMidlTool" AdditionalOptions="/cpp_cmdifort /cpp_opt"/nologo /fpp /P /E /Qoption,fpp,/no-fort-cont"" 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" ModuleDefinitionFile="Server4.def" SubSystem="subSystemWindows" LinkDLL="true"/>
<Tool Name="VFResourceCompilerTool" AdditionalIncludeDirectories="$(IntDir)\"/>
<Tool Name="VFMidlTool" AdditionalOptions="/cpp_cmdifort /cpp_opt"/nologo /fpp /P /E /Qoption,fpp,/no-fort-cont"" SuppressStartupBanner="true"/>
<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" DebugInformationFormat="debugEnabled" ParallelizerDiagLevel="parallelizerDiagLevel1" DebugParameter="debugParameterAll" WarnInterfaces="true" Interfaces="true"/>
<Tool Name="VFLinkerTool" ModuleDefinitionFile="Server4.def" GenerateDebugInformation="true" LinkDLL="true"/>
<Tool Name="VFResourceCompilerTool" AdditionalIncludeDirectories="$(IntDir)\"/>
<Tool Name="VFMidlTool" AdditionalOptions="/cpp_cmdifort /cpp_opt"/nologo /fpp /P /E /Qoption,fpp,/no-fort-cont"" 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" ModuleDefinitionFile="Server4.def" SubSystem="subSystemWindows" LinkDLL="true"/>
<Tool Name="VFResourceCompilerTool" AdditionalIncludeDirectories="$(IntDir)\"/>
<Tool Name="VFMidlTool" AdditionalOptions="/cpp_cmdifort /cpp_opt"/nologo /fpp /P /E /Qoption,fpp,/no-fort-cont"" 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="Do Not Edit">
<File RelativePath=".\Generated\clsfact.f90"/>
<File RelativePath=".\Generated\clsfactty.f90"/>
<File RelativePath=".\Generated\dllmain.f90"/>
<File RelativePath=".\Generated\IServer4.f90"/>
<File RelativePath=".\Generated\server.idl"/>
<File RelativePath=".\Generated\Server4Global.f90"/>
<File RelativePath=".\Generated\Server4TY.f90"/>
<File RelativePath=".\Generated\serverhelper.f90"/></Filter>
<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">
<File RelativePath=".\Server4.rc"/></Filter>
<Filter Name="Source Files" Filter="f90;for;f;fpp;ftn;def;odl;idl">
<File RelativePath="..\..\code\eos.f"/>
<File RelativePath="..\..\code\eos_const.f"/>
<File RelativePath="..\..\code\eos_enthalpy.f"/>
<File RelativePath="..\..\code\hybrd.f"/>
<File RelativePath="..\..\code\kub_eos.f"/>
<File RelativePath="..\..\code\main_prog_2.f"/>
<File RelativePath="..\..\code\mm.f"/>
<File RelativePath="..\..\code\para.f"/>
<File RelativePath="..\..\code\phase.f"/>
<File RelativePath="..\..\code\param_db.f"/>
<File RelativePath=".\Server4.def"/>
<File RelativePath=".\Generated\UIServer4.f90"/>
<File RelativePath=".\Generated\UServer4TY.f90"/>
<File RelativePath="..\..\code\utilities.f"/></Filter>
<File RelativePath=".\ReadMe.txt"/>
<File RelativePath=".\Server4.hie"/></Files>
<Globals/></VisualStudioProject>
]
The second project in the solution (console1) is the same code, but for use in the console. This project works fine in 64 and 32 bit.
Try to use MS Depends or Editbin utilities to verify all dependencies for the 32-bit DLL. Also, I found two references for the error 0x80040201 in Windows header files:
Also I have verified the dependencies of the 64bit and the 32bit dlls using dependency walker. For the 64bit all dependencies are 64bit. The 32bit dll pointed exclusively to 64bit system dll's. Would the full output be helpful?
Thank you for you help!
Matthias
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the comment and for checking these things. The 32bit version does not work for me, as I use 64bit matlab. The 64bit matlab does not support calling a 32bit COM-dll.
But your advise is correct! If I change the Target Machine setting to 32-bit and check the dll dependencies again, the 32-bit system dll's are correctly called. I cannot see a corresponding option for the 64-bit version. Is this ok, or am I doing something wrong?
PS: I really appreceate your help a lot. The long response time is due to other projects, that have stricter deadlines. It does not mean, that I don't care about your answers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No - that setting really isn't used anymore. Leave it "not set". The problem generally occurs when you migrate an old CVF project that explicitly had X86 set there.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page