dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Thread: Can't Load Type Library

  1. #1
    Join Date
    Jan 2003
    Posts
    33

    Can't Load Type Library

    I am getting a compilation error when doing:

    #import "myexe.tlb" raw_interfaces_only named_guids

    The error that I get is:
    fatal error C1084: Cannot read type library file: 'mydll.tlb': Error loading type library/DLL.

    I have also tried loading the exe directly ie. #import "myexe.exe"..., and I get the same error.

    I created a test app that calls LoadTypeLib(L"mydll.tlb", &ptLib). And this seems to work(it returns S_OK).

    Any ideas?

    Thx.

  2. #2
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    i guess the tlb isn't in proper path.
    or plz specify the path of tlb.
    i am not sure wether u can load exe or not.

    -Paresh

  3. #3
    Join Date
    Jan 2003
    Posts
    33
    actually if it put the full path I get the same error:

    #import "c:\my file path\myapp.tlb".....


    if I put a inproper tlb name, then I get a different error (file not found). There seems to be something with "loading" or "opening" the file.

  4. #4
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    so what exactly u r trying to do. if u have a COM component then u will have a dLL right. that u can add it by project refrence also. its quick easy and handy. than these import things.



    Paresh

  5. #5
    Join Date
    Jan 2003
    Posts
    33
    I must import because I only have the binary for the COM interface.

  6. #6
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    binary in terms of DLL ?
    i think if you have a dll why don't try an adding with reference.
    are you using VS.NET IDE editor ?

    Paresh

  7. #7
    Join Date
    Jan 2003
    Posts
    33
    >binary in terms of DLL ?
    Actually it is an .EXE

    >i think if you have a dll why don't try an adding with reference.
    Can this still be done with a .EXE?

    >are you using VS.NET IDE editor ?
    Yes, 2003 Final Beta.

  8. #8
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    oh ! I understood .. i think its an Inproc exe. why don't you make a dll out of it ..

    so you don't need to run. just provide methods and call it from .NET.
    isn't that good idea ?


    Paresh

  9. #9
    Join Date
    Jan 2003
    Posts
    33
    For anyone who runs into this issue.....


    In order to load a type library, all dependent type libraries must either be in the same directory path as the type library that you are trying to load or the dependent tlbs must be registered on the system.

    If none of the above have been done, and your tlb uses references other type libraries you will get a

    fatal error C1084: Cannot read type library file: 'mydll.tlb': Error loading type library/DLL.

  10. #10
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    its not necessary to have in same folder, but in path is ok.

    although registeration is the key factor without which you can't do loading or even create an instance. !!!

    check my earlier posts.


    I guess your problem is been solved !

    -Paresh Gheewala

  11. #11
    Join Date
    Sep 2006
    Posts
    1

    Re: Can't Load Type Library

    Quote Originally Posted by pareshgh
    binary in terms of DLL ?
    i think if you have a dll why don't try an adding with reference.
    are you using VS.NET IDE editor ?

    Paresh
    hi ...
    i am in same problem as mome ....
    but i have to do only by #import" " mathod ..
    i am using Vsual Studio2005 and in my workspace there is a NNN.tlb ..
    only one project(NNN) creating file NNN.tlb get bulid successfully with
    warning "MIDL2469 ignore :-no_robust commond" and making NNN.tlb
    file .but other project(xxx) in same workspace /solution using NNN.tlb(#import "NNN.tlb" raw_interface_only) .
    on building project xxx .it shows error c1084 :can't read NNN.tlb file ..
    can u solve my problem ...

    Thanx in advance..
    Last edited by rahuld; September 13th, 2006 at 05:12 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)