Question

I have a library written in C++ and I want to use structures from it when declaring interfaces in IDL file. Here is the sample:

service.idl

import "..//core//common_structures.h";
[
  object,
  uuid(13B01AEB-52EC-4546-BDE0-DE91B37337CE),
  dual,
  pointer_default(unique)
]
interface IDeviceManagement: IUnknown {
   HRESULT GetSerialByIndex  ([in] uint8_t id, [out] Serial *serial, [out, retval] VARIANT_BOOL *result);
};

Serial structure is defined in imported header under key_api namespace. When building everything goes ok until service_i.h is generated and the following error appears:

 error C2061: syntax error : identifier 'Serial'    ..\service\service_i.h

near these generated lines:

IDeviceManagement : public IUnknown
{
public:        
    virtual HRESULT STDMETHODCALLTYPE GetSerialByIndex( 
        /* [in] */ uint8_t id,
        /* [out] */ Serial *serial,
        /* [retval][out] */ VARIANT_BOOL *result) = 0;
};

I think it's because of Serial is wrapped under the namespace and service_i.h doesn't know anything about it. One solution is just to get rid of namespace. Is there any variant when we can actually keep the namespace?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top