locked
Could not register a 32 bit dll in Windows 7 64 bit

    Question

  • I have created a dll in VB (32 bit machine) and I am accessing the dll in my .NET application, it works fine in 32 bit machines but when I tried in 64 bit machine the application crashes.

    DLL registration is successfull through c:\windows\system32 folder and run cmd.exe with run as administrator, but while running the application the dll fails. I also tried the same from SysWOW64 folder.

    What am I doing wrong?

    Thanks

    Leo

    Sunday, March 28, 2010 11:22 AM

Answers

  • Hi mleslin,

       There are 2 tools for different purposes of software components' registeration. Regsvr32.exe and Regasm.exe. Following are their descriptions:

        Regsvr32.exe: The Regsvr32 Tool (regsvr32.exe) is used to register or un–register a COM DLL.

        Indeed, there're 2 versions of regsvr32.exe on 64-bit operating system. The one located at C:\Windows\SysWOW64 is 32-bit version. The one located at C:\Windows\System32 is 64-bit version.

        If your VB DLL is 32-bit COM DLL, the 32-bit version regsvr32.exe under C:\Windows\SysWOW64 should register it fine.

        Regasm.exe: The Assembly Registration tool reads the metadata within an assembly and adds the necessary entries to the registry, which allows COM clients to create .NET Framework classes transparently. Once a class is registered, any COM client can use it as though the class were a COM class. The class is registered only once, when the assembly is installed. Instances of classes within the assembly cannot be created from COM until they are actually registered.

        If your VB DLL is a managed module and to be used by COM clients, Regasm.exe should be used.

        If the above information doesn't solve your problem, please provide us with the error messages of the DLL failure and we will look into it.

     


    Please mark the right answer at right time.
    Thanks,
    Sam

    • Edited by SamAgain Monday, April 12, 2010 4:33 AM refine
    • Marked as answer by SamAgain Tuesday, April 13, 2010 10:10 AM
    Monday, April 12, 2010 4:16 AM

All replies

  • Hi mleslin,

       There are 2 tools for different purposes of software components' registeration. Regsvr32.exe and Regasm.exe. Following are their descriptions:

        Regsvr32.exe: The Regsvr32 Tool (regsvr32.exe) is used to register or un–register a COM DLL.

        Indeed, there're 2 versions of regsvr32.exe on 64-bit operating system. The one located at C:\Windows\SysWOW64 is 32-bit version. The one located at C:\Windows\System32 is 64-bit version.

        If your VB DLL is 32-bit COM DLL, the 32-bit version regsvr32.exe under C:\Windows\SysWOW64 should register it fine.

        Regasm.exe: The Assembly Registration tool reads the metadata within an assembly and adds the necessary entries to the registry, which allows COM clients to create .NET Framework classes transparently. Once a class is registered, any COM client can use it as though the class were a COM class. The class is registered only once, when the assembly is installed. Instances of classes within the assembly cannot be created from COM until they are actually registered.

        If your VB DLL is a managed module and to be used by COM clients, Regasm.exe should be used.

        If the above information doesn't solve your problem, please provide us with the error messages of the DLL failure and we will look into it.

     


    Please mark the right answer at right time.
    Thanks,
    Sam

    • Edited by SamAgain Monday, April 12, 2010 4:33 AM refine
    • Marked as answer by SamAgain Tuesday, April 13, 2010 10:10 AM
    Monday, April 12, 2010 4:16 AM
  • Hi mleslin,

       I mark this thread for now. Please let us know your further concerns if necessary.


    Please mark the right answer at right time.
    Thanks,
    Sam
    Tuesday, April 13, 2010 10:10 AM
  • Hi Sam,

    Thanks for the response.

    First one did not work, I tried registering in SysWOW64 folder, it registers successfully but inside the application it fails.

    2nd one I did not try it.

    Since it is a production environment I did not have chance to spend time so I included the code in the application itself to make it work.

    Thanks again.

    Leo

    Sunday, May 23, 2010 1:54 PM
  • Incidentally I had a problem at first registering a VB6 dll under 64 bit windows 7 using the sysWOW64 version too. I was able to do it though after remembering to run the command prompt as administrator.
    Monday, May 23, 2011 8:23 PM
  • Thank SamAgain, your help is useful ^^
    Wednesday, June 22, 2011 7:27 AM
  • Kindly change the all exe and dll file target to x86 not "any cpu" or "x64".

    x86 exe and dll file will run smoothly on x64 bit os.

     

    Regards

    Parikshit

    Saturday, October 22, 2011 7:40 AM
  • Retrieving the COM class factory for component with CLSID {4EC4272E-2E6F-4EEB-91D0-EBC4D58E8DEE} failed due to the following error: 80040154.
    Wednesday, August 08, 2012 9:36 AM
  • Retrieving the COM class factory for component with CLSID {4EC4272E-2E6F-4EEB-91D0-EBC4D58E8DEE} failed due to the following error: 80040154.

    this kind of error i get

    Wednesday, August 08, 2012 9:37 AM
  • Hi ,

    I have below machine environments
     
    64 bit OS with 64 bit visio
    64 bit OS with 32 bit visio
     
    32 bit OS with 32 bit visio
     
    I am creating an application using axdrawing control for Visio functions.
     
    If i make target framework=AnyCPU then 
    it fails for 64 bit OS with 32 bit visio
    if i make target framework =X86 ,then 
    it fails for 64 bit OS with 64 bit visio.
     
    How can i create single exe , that would run on all above environments

    Monday, September 03, 2012 10:58 AM
  • Hi,

    I have the same problem , and I try to registering the 32 bit dll files this way, but I did not get any confirmation message.

    When I searched for my dlls in the Registry Editor, I did not find it.

    How can I solve my problem?

    Thanks in advance,

    Aya.


    Aya Zoghby

    Thursday, September 20, 2012 6:28 PM