已锁定 Creating 64-bit interop dlls from an ActiveX component

  • Thursday, January 11, 2007 11:05 AM
     
     
    Hi there,

    I have generated a 64-bit version of an old ActiveX component. I now need to create the appropriate interop dlls to be able to use this component from some managed code. Here's what I've tried:

    > tlbimp myDll.ocx /out:myDllInterop.dll /machine:x64

    This generates the error:
    TlbImp : error TI0000 : A single valid machine type compatible with the input type library must be specified

    From this error, it appears that I might not have a 64-bit activeX component. But when I check it using DependencyWalker, it says it IS a 64-bit dll. Is it possible that the typelib info inside the ocx is only 32-bits. If so, how can I verify that? OleView doesn't give me enough info about the bit-ness of the tlb. And more importantly, how can I force a 64-bit typelib info to be embedded inside the ActiveX control?

    I've also tried aximp, but it doesn't seem to have any option to specify a target machine type at all

    Do I have to write my own tlbimp/aximp using the TypeLibConverter class? Can anyone point me in the right direction please?
    Thanks
    Ahsan

All Replies

  • Thursday, January 11, 2007 11:48 AM
     
     
    
    Hi there,

    I have generated a 64-bit version of an old ActiveX component. I now need to create the appropriate interop dlls to be able to use this component from some managed code. Here's what I've tried:

    > tlbimp myDll.ocx /out:myDllInterop.dll /machine:x64

    This generates the error:
    TlbImp : error TI0000 : A single valid machine type compatible with the input type library must be specified

    From this error, it appears that I might not have a 64-bit activeX component. But when I check it using DependencyWalker, it says it IS a 64-bit dll. Is it possible that the typelib info inside the ocx is only 32-bits. If so, how can I verify that? OleView doesn't give me enough info about the bit-ness of the tlb. And more importantly, how can I force a 64-bit typelib info to be embedded inside the ActiveX control?

    I've also tried aximp, but it doesn't seem to have any option to specify a target machine type at all

    Do I have to write my own tlbimp/aximp using the TypeLibConverter class? Can anyone point me in the right direction please?
    Thanks
    Ahsan
    Are you sure you run the 64bit version of tlbimp?
     
    Willy.
     
  • Friday, January 12, 2007 3:11 AM
     
     
    Hi Willy,

    I've tried both versions of tlbimp that are installed on my m/c
        C:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0\bin\tlbimp.exe
        C:\Program Files\Microsoft.Net\SDK\v2.0 64bit\Bin\tlbimp.exe

    They both result in the same error message.
    BTW, I'm running on XP x64 (in case it matters)
    Thanks
    Ahsan
  • Thursday, October 08, 2009 7:44 AM
     
     
    hi ,
     I have tried same thing  but it was failure , and I thing  /tlbreference:FileName can  help u out but   i dont know  how to user this 


    Divyang   
  • Thursday, May 20, 2010 2:51 AM
     
      Has Code

    Correct your .proj file, add the following node to any of the '(Configuration)|Any CPU' nodes that are missing it:

    <PlatformTarget>
    AnyCPU
    </PlatformTarget>
    

    If this node is not present TlbImp will default to x86 and cause issues.

  • Thursday, May 20, 2010 10:11 PM
     
     
    What scenario are you thinking of that you need this as x64? You have a .NET client program that will start up and load this.  If your interop assembly is MSIL/AnyCpu, then it will follow the bitness of your client program just like any other assembly would.   The short answer is that I don't think you need an explicit 64-bit interop assembly.
    Phil Wilson
  • Thursday, July 19, 2012 6:27 AM
     
      Has Code

    谢谢提醒,因为这个问题困扰了我多半天,解决。


    Correct your .proj file, add the following node to any of the '(Configuration)|Any CPU' nodes that are missing it:

    <PlatformTarget>
    AnyCPU
    </PlatformTarget>
    

    If this node is not present TlbImp will default to x86 and cause issues.


    • Edited by cxq777 Thursday, July 19, 2012 6:28 AM
    •