简体   繁体   English

如何从Windows32的oleaut32.dll上使用#import进行64位项目

[英]How to use #import on oleaut32.dll from windows32 for 64bit project

I have this big visual studio solution that is currently on 32 bits (x86) for an application that uses Standard Windows Libraries,uses Multi-Byte Character Set and has No Common Language Runtime Support.I was tasked to compile it on 64 bits(stuff for work).I want to import oleaut32.dll library because it is on 64 bits. 我有一个大型Visual Studio解决方案,当前针对使用标准Windows库,使用多字节字符集且不提供公共语言运行时支持的应用程序为32位(x86)。我受命在64位上编译它(东西我想导入oleaut32.dll库,因为它在64位上。

When i started to change the platform of the project and compile it,I got some compilation errors(32 bit functions ,linking problems) ,most of them are solved now.The issue is that it imported olepro32.dll (which worked on 32bits),it says it is an old format or invalid type library (because it is a 32 bit library). 当我开始更改项目的平台并进行编译时,我遇到了一些编译错误(32位函数,链接问题),现在大多数问题都已解决。问题是它导入了olepro32.dll(可在32位上运行) ,它表示它是旧格式或无效的类型库(因为它是32位的库)。

I searched the internet for it's 64 bits version and found out it is oleaut32.dll.I tried to import it ,but it won't let me i get error C1083: c:\\windows\\system32\\oleaut32.dll': Error loading type library/DLL . 我在互联网上搜索了它的64位版本,发现它是oleaut32.dll。我尝试导入它,但它不会让我出现错误C1083: c:\\windows\\system32\\oleaut32.dll': Error loading type library/DLL

I tried to change the project properties(Changed from: No Common Language Runtime Support to Common Language Runtime Support ,it didn't work ). 我试图更改项目属性(从“ No Common Language Runtime Support更改 Common Language Runtime Support ,它不起作用”)。

I looked on microsoft website for the causes of error C1083 ,where I suspected the issues were: 我在Microsoft网站上查找了错误C1083的原因,我怀疑其中的原因是:

  1. Third-party library issues and Vcpkg 第三方库问题和Vcpkg
  2. The file may be locked or in use 该文件可能已锁定或正在使用中
  3. The wrong version of a file name is included 包含错误版本的文件名
  4. The precompiled headers are not yet precompiled 预编译的头文件尚未预编译
  5. The file uses managed code, but the compiler option /clr is not specified. 该文件使用托管代码,但未指定编译器选项/ clr。 For more information, see /clr (Common Language Runtime Compilation) 有关更多信息,请参见/ clr(公共语言运行时编译)
  6. The file, the directory, or the disk is read-only 文件,目录或磁盘是只读的
  7. Visual Studio or the command line tools do not have sufficient permissions to read the file or the directory. Visual Studio或命令行工具没有足够的权限来读取文件或目录。

I tried running visual studio with administrator privilages ,it didn't work. 我尝试以管理员权限运行Visual Studio,但没有用。

I found out it is a COM library,I don't know what's the deal with it. 我发现这是一个COM库,我不知道该怎么处理。

On x86 platform the code was : 在x86平台上,代码为

#import  <olepro32.dll> rename("FONTSIZE", "FONTSIZE_OLE32") no_auto_exclude include("IFont", "IPicture")

On x64 platform I tried to replace the code above with: 在x64平台上,我尝试将上面的代码替换为:

#import  <oleaut32.dll> rename("FONTSIZE", "FONTSIZE_OLE32") no_auto_exclude include("IFont", "IPicture")

I was expecting that this would run smoothly since oleaut32.dll is a 64 bit library situated in windows32 folder.But I get Error loadin DLL 我期望这会顺利运行,因为oleaut32.dll是位于Windows32文件夹中的64位库。但是我在Error loadin DLL加载Error loadin DLL

oleaut32.dll has no relation with olepro32.dll and is not a Typelib oleaut32.dll与olepro32.dll没有关系,并且不是Typelib

olepro32.dll is a TypeLib and exposes IPicture and IFont interfaces olepro32.dll是TypeLib,它公开IPictureIFont接口

You include those interfaces with : 您可以通过以下方式包含这些接口:

#include <ocidl.h> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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