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


Here's my situation:
I've created a simple .NET C# Class Library that uses
In it, I define this interface (that exposes some basic functions):

public interface IServiceWrapper

that this class implements

public class ServiceFactory : IServiceWrapper

That's all it is in .NET C#.

After compiling I use
regasm ServiceProvider.dll /tlb:ServiceProvider.tlb
to create and register the type library.

Visual Studio C++ 6.0
In some class in an MFC project:
#import "c:\ServiceProvider.tlb"
using namespace ServiceProvider;
double MyClass::SomeFunction()
  hr = CoInitialize(0);
  double jj = 0;

    IServiceWrapperPtr pCOMWrapper(__uuidof(ServiceFactory));
    jj = pCOMWrapper->SomeFunction();
    char buffer[20];
    _itoa (jj, buffer, 10);
  catch (_com_error error )
    char buffer[256];
    wsprintf(buffer, "Error: 0x%x %S", error.Error(),
    AfxMessageBox(buffer, MB_OK);


  return jj;

Ok. What I am doing is using .NET DLL's in a Visual C++ 6.0 project
using Interop.
In my machine all goes smoothley.

The error I specified happens when I use the .NET DLL and TLB in
another machine.
I've tryied to register the TLB using regtlib but the error persists.

I'm a newbie at .NET framework and I hope you can clear my doubts.

Many thanks!


Relevant Pages

  • Re: Interop Interface from .Net to VB6
    ... The tlb I get is not generated by the .net Compiler, but by my build process step of calling regasm ... implement the interface ICommand. ... Again since, in my original system, the interface is created in .Net and then the tlb is generated from it, perhaps this is a side effect of doing things in a different order or a different dependancy chain. ... I was kinda expecting that my .Net dll would still be the same but that the tlb would effectively include better info that would have been generated with my other method. ...
  • Re: object as parameter
    ... Interfaces Type Library Version 1.0" in the list of references. ... interface IDatabaseData: IDispatch ... I have a question on composing tlb at this point ... its similar to the issue with a dll and compatibility settings when you add ...
  • Re: Question regarding fgets and new lines
    ... Mine follows the precedent of things like getenv: ... signature `char *getline' is simple enough that even I can ... making them part of the "interface contract") was good enough. ... I'd have returned the "payload" ...
  • Re: is there anything unstandard in the c part here
    ... interface with the called language. ... The function copies the string s2, not including its terminating null character, to successive elements of the array of char whose first element has the address s1. ... The function then stores zero or more null characters in the next elements to be altered in s1 until it stores a total of n characters. ... function testc() bindresult ...
  • Re: How to LPCTSTR Convert to char *
    ... number of people who use 'char' because they've never grown beyond their first programming ... These are the people who are getting nuked by VS2005 which defaults to Unicode apps. ... isolated to the embedded interface (rare and exotic situation imposed by external ... fields with char strings is quite essential. ...