如何将 64 位程序转换为 32 位程序

2025-10-21 00:52:59

C++ 编写的COM程序在被托管程序(C#) 调用时,会因为64位和32位不兼容的问题,不能被调用,需要转换。

那么如何实现 32/64位的互转换那? 答案是使用 VS tool 提供的 corflag.exe 程序。

工具/原料

VS 2010 及以后版本

方法/步骤

打开 VS Command Tool

Windows->Start -> VS -> VS xx Command Promot

输入 corflags.exe

输入 corflag.exe -? 获取帮助

Usage: Corflags.exe Assembly [options]

If no options are specified, the flags for the given image ar

Options:/ILONLY+ /ILONLY-       Sets/clears the ILONLY flag/32BITREQ+ /32BITREQ-   Sets/clears the bits indicating 32-bi/32BITPREF+ /32BITPREF- Sets/clears the bits indicating 32-bi/UpgradeCLRHeader       Upgrade the CLR Header to version 2.5/RevertCLRHeader        Revert the CLR Header to version 2.0/Force       诉廊           Force an assembly update even if the           劣仗欧             strong name signed.                        WARNING: Updating a strong name signe                         will require the assembly to be resi                         it will execute properly./nologo                 Prevents corflags from displaying log

输入转屈压换命令

注意事项

管理员权限

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢