tags:

views:

65

answers:

2

I inherited a lib that compiled in x32 and I can't compile it to x64. I think may be to envelop the lib with x32 process and then to run it in x64 process by calling to CreateProcess function win api. then I will use shared memory for transfert the data between the API lib x32 interfaces to the x64 process.

Do I miss something here(its look very complicated)?

+2  A: 

I think you could expose it as 32bit COM+ server and consume it from 64bit app. It will be separate process hosted by OS. It seems to me much easier than shared memory etc. Just idea, I never tried.

Pavel Savara
nothing........
+1  A: 

They answer is that you cannot do this directly. Processes are either 32-bit, or 64-bit. A 64-bit process cannot load a 32-bit code.

Yes, you have to run the 32-bit code in a 32-bit process and use some type of interface between it and your 64-bit process.

Depending on your code, this could be a lot of work.

The best way to do this is likely to wrap your 32-bit code in a set of COM APIs and run it as an our of proc COM server for your 64-bit process. COM will then do all the work of marshaling information from one process to another.

No matter what you do; be acutely aware that there is a LOT of overhead to do this. Error handling is another significant concern.

I encourage you not to develop your own shared memory interface. This can be quite challenging to get corrects unless the interfaces are really simple.

You could also use RPC directly: see this link.

Foredecker