How to register a 64-bit COM dll on 64-bit Windows 7?

atl, com, regsvr32, visual-c++, windows-7-x64

Solution

How is the command being run? From a process or from a command line?

Make sure the command is being run from a 64-bit process (or a 64-bit cmd.exe console window). Otherwise, the `%windir%\System32\regsvr32.exe` command will be redirected to `%windir%\SysWoW64\regsvr32.exe` and a 32-bit regsrv32 will be run (which can't register 64-bit DLLs).

You could also try using `%windir%\sysnative\regsvr32.exe` which will redirect to the real `%windir%\System32\` directory (but only from a 32-bit process, so if you use that take care to make sure no one tries to run the command from a 64-bit process).

See File System Redirector on MSDN for details.

Problem

I'm trying to register an x64 COM server dll for use in x64 office on x64 windows 7. I have followed the instructions here but I cannot register the dll. When I attempt to I get the following error: The command I use is `regsvr32 my_x64_com_server.dll` Why is this happening and is there a workaround? Thanks in advance.

Original source