I need to migrate a 32bit dll in order to use it in a 64bit C# (and also C++) applications. The dll is write in unmanaged delphi code. I can't recompile the dll and the only way is to use the interprocess communication (IPC). I search for a long time but i found not many information about. The best guide i found is in this link: Accessing 32-bit DLLs from 64-bit code.
I followed this guide for achieve my goal because very often is quoted in this forum. So the guide explain I have to make three steps:
1° STEP - Create a 32-bit component implementing a COM object which loads and calls into the 32-bit DLL, and exposes the 32-bit DLL interface as a COM interface. So I made the same thing as explained here (example taken from previous link):
[ComVisible(true), GuidAttribute("137AD71F-4657-4362-B9E4-C6D734F1F530")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface IGetMyString
{
string GetMyString();
}
[ComVisible(true), GuidAttribute("89BB4535-5A89-43a0-89C5-19A4697E5C5C")]
[ProgId("CallPDW.Class1")]
[ClassInterface(ClassInterfaceType.None)]
public class Class1 : IGetMyString
{
string GetMyString()
{
......
}
}
Then i have to register the .NET COM assembly so i have to use Regasm.exe, but instead I created Visual Studio Setup and Deployment project that builds an MSI file and make the same things Regasm do. Then i controlled the Registry Editor and I found the HKEYs so it works. So until this step all is ok or seems to be ok.
2° STEP - Configure this COM components for out-of-process (OOP) by either creating a standard COM+ OOP application (using dllhost as the surrogate process);
3° STEP - Create a 64-bit wrapper DLL which implements the same interface as the original 32-bit DLL, imports the COM interface of the COM object created above, translates current calls to the exposed interface into calls to the COM object interface, transfers the call parameters, receives return values and delegates them to the callers;
The problem is that the 2° and the 3° STEPs I have no idea how to achieve because I don't found anything on the web or in the forum about this. So I need help to achieve step 2° and 3°. Is ok also some link to other posts etc. Thanks in advance.
OTHER INFORMATIONS (12/10/2016 - 11:10 PM): This DLL expose its functions to the 32bit native environment through two interfaces: 1.) a C/C++ header with function pointers (WINAPI*) 2.) a .NET interface with P/Invoke