0

I have an issue with generating Interop by using tool TlbImp.exe

The input dll is 64 bits, but output Interop is 32 bits. I do not have control over the input dll, it is given by third part.

I have downloaded dumpbin feature and test both dlls.

A. Command:

@"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. Input 64 bit 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. Output 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. I have tried to modify the command I am using for the way like this:

@"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

but then I am receiveing an error like this:

TlbImp : error TI2010 : A single valid machine type compatible with the input type library must be specified.

Please let me know how I can overgo this error ? I would like to produce 64 bits Interop dll from 64 bits library. I believe it is possible. In case thre is no least chance to do it without changing input dll please let me know as well this. Then I would need to report third party company. But before I would be sure I can't overgo this.

I have done also the question: Generate 64 bit Interop issue but I feel I had not give enough informations or somehow I would deploy this question as it is more clear I hope. If the admin have a problem with that please delete the other one and leave this. Thanks.

jan kowalski
  • 189
  • 3
  • 21

1 Answers1

0

I have similar issue when run tlbimp on Windows 32 bit on 64 bit COM dll.

When I run the same command on Windows 64 bit interop generation succeeds.

TlbImp : Type library imported to [cut]\x64bin\Interop.[cut].dll

TlbImp versions are the same: Microsoft (R) .NET Framework Type Library to Assembly Converter 4.6.1055.0

Looks like a Microsoft bug to me.