简体   繁体   中英

.Net COM interop with 32 and 64 bit platforms

I am using a third party COM component and the vendor has supplied both 32 and 64 bit versions of it. I want to build my .NET application for "any cpu" and have it invoke the 32 bit COM component if the process is 32 bit, or the 64 bit component in 64 bit mode.

Can anyone point me at any useful resources to describe how this process works? does it just happen by magic if I register the correct COM component?

Thanks

Andy

A 32 bit process will load the 32 bit COM server and a 64 bit process will load the 64 bit COM server. In other words, so long as you install the right COM server on the target machine, you should have to do precisely nothing for this to just work.

Use 32 bit COM dll.

If you application type is Web, Refer your 32 bit COM dll and deploy the app. In IIS Set 'Enable 32bit Application = TRUE.

In Windows App, Just refer the 32 bit dll and build the app with 'Any CPU'.

AFAICT COM is (has always been) a binary standard interface.

It's definition will not depend on byte-ordering, word-size or other architecture dependent details. It is perfectly possible (and not even that difficult, for simple interfaces) to code a COM component that complies with all of that in plain C code.

Certain indivuals (Don Box, Craig Brockschmidt, I have a feeling I'm somehow forgetting about the most known one... bad memory) have been quite famous for writing books about how COM is implemented in just that way.

If you want any confirmation, you can confirm that the output of MIDL doesn't depend on your platform characteristics

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM