RE: Forward Declare an interface for IDL
Hi Juan,
The error seemed caused by uuid attribute. I performed a test at my side,
if uuid attribute was removed, the compilier error C3163 did not occur. I
will consult the Dev team on this issue to see what the root cause of this
issue is here and I will let you know the result. Since the process may
need a long time, could you please just leave me
(changliw_at_microsoft_dot_com) an email response so that I can timely
update you when I get the response from the Dev team.
However I did not reproduce your original issue at my side. Directly using
"[export]__interface IFace;" was also fine at my side. You may refer to my
code snippet:
//iface.h
#pragma once
[object, uuid("00000000-0000-0000-0000-000000000001"), library_block ]
__interface IFace:IDispatch {
[ id(0) ] int int_data;
[ id(5) ] BSTR bstr_data;
};
//--MyClass.h
#pragma once
#define _ATL_ATTRIBUTES 1
#include <atlbase.h>
#include <atlcom.h>
#include <comdef.h>
[export]
__interface IFace;
[coclass, uuid("00000000-0000-0000-0000-000000000002") ]
class MyClass
{
private:
int m_i;
BSTR m_bstr;
IFace* m_pFace;
public:
MyClass(void);
~MyClass(void);
void AttachFace(IFace* pFace);
};
//myclass.cpp
#include "MyClass.h"
#include "IFace.h"
void MyClass::AttachFace(IFace* pFace)
{
m_pFace = pFace;
if(m_pFace->int_data==0)
m_pFace->int_data = 1;
}
For further research, is it convenient for you to send me an sample project
of yours so that I can reproduce your issue at my side?
If you have any other questions or concerns, please feel free to let me
know. Have a nice day!
Best regards,
Charles Wang
Microsoft Online Community Support
=====================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================