tags:

views:

27

answers:

0

I need to importlib a VB6 dll for consumption by an ATL component. I'm not able to use the MIDL import keyword for various reasons. I'm getting a C2061 error in my project in the generated header file (test_i.h) : syntax error: identifier '_MyDataType'. My idl file is

import "oaidl.idl";
import "ocidl.idl";

[
uuid(8BB809C6-B5EC-48B1-9A5E-826380BC5355),
version(1.0),
helpstring("Test 1.0 Type Library")
]
library TestLib
{
importlib("MyDataType.dll");
importlib("stdole2.tlb");

 [
object,
uuid(B127CFB2-F47E-4A08-B06F-72A059E101AF),
dual,
nonextensible,
helpstring("ITestClass Interface"),
pointer_default(unique)
 ]
 interface ITestClass : IDispatch{
[id(1), helpstring("foo")] HRESULT MyDataTypeTest([in,out] _MyDataType** Settings);
};

[
    uuid(11C8D6A2-7802-4112-B647-E8F56835EE5F),
    helpstring("TestClass Class")
]
coclass TestClass
{
    [default] interface ITestClass;
};
};

and my class is

// TestClass.h : Declaration of the CTestClass

#pragma once
#include "resource.h"       // main symbols
#import "MyDataType.dll" raw_interfaces_only, raw_native_types, named_guids, no_namespace
#include "Test_i.h"


// CTestClass

class ATL_NO_VTABLE CTestClass :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CTestClass, &CLSID_TestClass>,
public ISupportErrorInfo,
public IDispatchImpl<ITestClass, &IID_ITestClass, &LIBID_TestLib, /*wMajor =*/ 1,        /*wMinor =*/ 0>
{
 public:
CTestClass()
{
}

 DECLARE_REGISTRY_RESOURCEID(IDR_TESTCLASS)


BEGIN_COM_MAP(CTestClass)
COM_INTERFACE_ENTRY(ITestClass)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
END_COM_MAP()

    // ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);


DECLARE_PROTECT_FINAL_CONSTRUCT()

HRESULT FinalConstruct()
{
    return S_OK;
}

void FinalRelease()
{
}

public:

STDMETHOD(MyDataTypeTest)(_MyDataType** Settings);
};

OBJECT_ENTRY_AUTO(__uuidof(TestClass), CTestClass)

Other than the importlib and the #import, everything is set up by the ATL wizard. The generated header file has

MIDL_INTERFACE("B127CFB2-F47E-4A08-B06F-72A059E101AF")
ITestClass : public IDispatch
{
public:
    virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE MyDataTypeTest( 
        /* [out][in] */ /* external definition not present */ _MyDataType **Settings) = 0;

};

I'm obviously doing something wrong here, but for the life of me can't figure it out. This ancient thread seems to have the same problem, however without resolution. I'm on VS2008. Thanks for any help.