我在使用工具 TlbImp.exe 生成互操作时遇到问题
输入 dll 是 64 位,但输出 Interop 是 32 位。我无法控制输入 dll,它由第三方提供。
我已经下载了 dumpbin 功能并测试了两个 dll。
A. 命令:
@"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\TlbImp.exe" "C:\Program Files\SAP\SAP Business One DI API\DI API 90\SAPbobsCOM90.dll" /out:"%CD%\SAPbobsCOM.dll"
B. 输入 64 位 dll dumpbin:
Dump of file C:\Program Files\SAP\SAP Business One DI API\DI API 90\SAPbobsCOM90.dll
PE signature found
File Type: DLL
FILE HEADER VALUES
8664 machine (x64)
6 number of sections
59C18858 time date stamp Tue Sep 19 23:12:56 2017
0 file pointer to symbol table
0 number of symbols
F0 size of optional header
2022 characteristics
Executable
Application can handle large (>2GB) addresses
DLL
OPTIONAL HEADER VALUES
20B magic # (PE32+)
C. 输出 Interop dll dumpbin:
Dump of file C:\Users\dariuszg\Desktop\dllki 64 bitowe\Interop.SAPbobsCOM.dll
PE signature found
File Type: DLL
FILE HEADER VALUES
14C machine (x86)
3 number of sections
5A5628D1 time date stamp Wed Jan 10 15:53:05 2018
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
2102 characteristics
Executable
32 bit word machine
DLL
OPTIONAL HEADER VALUES
10B magic # (PE32)
D. 我试图修改我正在使用的命令,如下所示:
@"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\TlbImp.exe" "C:\Program Files\SAP\SAP Business One DI API\DI API 90\SAPbobsCOM90.dll" /out:"%CD%\Interop.SAPbobsCOM.dll" /namespace:SAPbobsCOM /machine:X64
但后来我收到这样的错误:
TlbImp : error TI2010 : A single valid machine type compatible with the input type library must be specified.
请让我知道如何克服这个错误?我想从 64 位库中生成 64 位 Interop dll。我相信这是可能的。如果在不更改输入 dll 的情况下有机会做到这一点,请让我知道这一点。然后我需要报告第三方公司。但在我确定我不能超越这一点之前。
我也做了这个问题:Generate 64 bit Interop issue,但我觉得我没有提供足够的信息,或者我会以某种方式部署这个问题,因为我希望它更清楚。如果管理员对此有疑问,请删除另一个并离开。谢谢。