开发者

How can I use the function CoGetClassObject in x64

开发者 https://www.devze.com 2022-12-28 05:08 出处:网络
I have a COM DLL that is compiled in 32-bit mode (the server side). I registered开发者_如何学运维 it and tried to call CoGetClassObject() from a 32-bit client for getting the IClassFactory.

I have a COM DLL that is compiled in 32-bit mode (the server side). I registered开发者_如何学运维 it and tried to call CoGetClassObject() from a 32-bit client for getting the IClassFactory.

Hr = CoGetClassObject(CLSID_IOrbCom, CLSCTX_INPROC_SERVER,
   0 , IDD_IClassFactory, (LPVOID*)&ClassFactory)

and it works just fine for 32-bit client. Yet when I tried to call CoGetClassObject() from a 64-bit client I got "Class not registered" error.

I can only have my COM server compiled in 32-bit mode. My OS is 64 bit Windows XP.

How do I make it work?


This is the expected behavior - you can't load a 32-bit dll into a 64-bit client process, this is just not supported by the OS. You'll have to either recompile the server (and register the 64-bit version of it) or use DCOM, COM+ or other interop solution that would run the 32-bit code in a separate process and marshal calls from the client into that process using RPC.

0

精彩评论

暂无评论...
验证码 换一张
取 消