32 Bit dll in 64 bBit application

1

I need to run the vb6 32 Bit dll in .net application. When I run the application in X86 it works fine. But when I run the application in "Any Cpu" Configuration it gives Following Error:

Retrieving the COM class factory for component with CLSID {AAA4DA7D-FC03-4BF7-B240-FA6F323D41EE} failed due to the following error: 800700c1 is not a valid Win32 application. (Exception from HRESULT: 0x800700C1).

For the Code line

CommonUniqueObj = New Uniquekey.Class1

How to solve this error. I want to run the .net application in "Any cpu" configuration?

vb.net
dll
vb6
asked on Stack Overflow Nov 28, 2020 by IT researcher • edited Nov 28, 2020 by Olivier Jacot-Descombes

2 Answers

2

AX (COM) DLLs run in-process, and as the comments say, you can't mix x86 and x64 code directly.

One possible workaround is to compile the VB6 DLL as an AX EXE instead. 64-bit programs can instance AX EXEs and data can be marshalled between them, since they run in separate processes.

answered on Stack Overflow Nov 28, 2020 by Jim Mack
0

You can mix 32 bit and 64 bit. By calling into an exe bitness doesn't matter. Data is marshalled as with any out of process call.

DLLs can be run in an exe by setting registry values.

See https://docs.microsoft.com/en-us/windows/win32/com/dllsurrogate

PS when using an exe it is a good idea to always set everytime just before you use it in case the user has terminated the dllhost.exe that hosts the DLLs.

answered on Stack Overflow Dec 12, 2020 by user14797724 • edited Dec 15, 2020 by user14797724

User contributions licensed under CC BY-SA 3.0