Reputation: 3821
I'm writing an add-in for an application which runs in 64 bit, however I need to use objects from a 32 bit library (this library only comes in 32 bit). Is there any way I can accomplish this?
Upvotes: 3
Views: 234
Reputation: 612954
The rule here is simple, but not what you want to hear. All code in a single process has to have the same bit-ness. If your hosting process is 64 bit then all code in that process must be 64 bit also. Hence, if you need to run 32 bit code, you must put the 32 bit code in a separate process and use some form of IPC.
Upvotes: 7
Reputation: 5980
This is quite easy in .NET. You just need all modules in a process to be the same bit-width.
So you simply start a child 32bit process, put all 32bit DLLs there, and use remoting features of .net to call procedures in it. Or as used to say in COM-times: Use out-of-process component server.
It will get more complicated when you need to pass a lot of data between 32bit and 64bit modules. You can setup memory-sharing, but it requires more work than normal.
Upvotes: 8