CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2010
    Posts
    53

    Why (LoadTypeLibEx failed : : Error loading type library/DLL. (Exception from HRESULT

    Hello,

    I am Loading type library from C++/CLI with following lines of code.

    [DllImportAttribute("oleaut32.dll", SetLastError = true, CharSet = CharSet::Unicode, PreserveSig=false)]

    static void LoadTypeLibEx( String^ strTypeLibName, RegKind regkind,[MarshalAs(UnmanagedType::Interface)] interior_ptr typeLib );

    Object^ oTypeLib;
    LoadTypeLibEx( strSubject,RegKind::RegKind_None, &oTypeLib);

    It again and again giving me same exception, all I have registered type library with regsrv32, placed in current directory and given full qualified path but still its giving me same exception. Any way around?

    Regards
    Usman
    Last edited by glitteringsound; June 7th, 2010 at 11:53 AM.

  2. #2
    Join Date
    Jul 2002
    Posts
    2,543

    Re: Why (LoadTypeLibEx failed : : Error loading type library/DLL. (Exception from HRE

    Why do you need PInvoke in C++/CLI? Call LoadTypeLibEx directly, as in good old C++. C++/CLI allows to write unmanaged code in any place.

  3. #3
    Join Date
    Jan 2010
    Posts
    53

    Re: Why (LoadTypeLibEx failed : : Error loading type library/DLL. (Exception from HRE

    I have done almost whole code of interop services using this managed syntax and declared every where objects of TypeLib and TypeInfo with managed type i.e ^.

    LoadTypeLib is native and requires all native syntax. So ITypeLib^ won't work on this. Can you please tell me what's wrong with PInvoke calling code of LoadTypeLib.

    I am getting issues of converting pin_ptr to managed and managed to pin_ptr and usage as whole of managed types in the code.
    Last edited by glitteringsound; June 7th, 2010 at 01:13 PM.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured