views:

23

answers:

0

I've created a COM-class that implements some interface. I want to add a method to this interface. The parameter of this method is a pointer to the interface defined in some external olb-file. In my project this olb-file imported without no_namespace directive. So, the interface name in the parameter of the method must be qualified in h\cpp files. But MIDL doesn't recognize namespaces and generates header file with unqualified interface in the method. So, error C2061. A little sample:

//stdafx.h
#import "somelib.olb" named_guids no_function_mapping

In somelib.olb defined interface Foo. It's qualified name in my project is someLib::Foo

//myproject.idl
...
[
  object,
  uuid(...),
  ...
]
library MyProjectLib
{
  importlib(somelib.olb);
  ...
  [
     object,
     uuid(...),
     helpstring(...),
     pointer_default(unique)
  ]
  interface IMyInterface : IUnknown{
     [propputref, helpstring("...")] HRESULT Bar ([in] IFoo* Parent);
  };

MIDL generates header file MyProject.h

//MyProject.h
...
IMyInterface : public IUnknown
{
public:
    virtual /* [helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_Bar( 
        /* [in] */ /* external definition not present */ IFoo *Parent) = 0;
};
...

And error message

error C2061: syntax error : identifier 'IFoo'

How to solve this problem? Thanks in advance.