Exposing an external interface
-
This is really getting up my nose now. How do you, using ATL7 in VS7.1, expose an external COM interface to your COM implementation? If I import the type library (xxx.tlb), it complains of type definition. This is a snippet of what's in my header file. The error code generated is listed below Test.tlb is an external type library.
#import "Test.tlb" no_namespace // ITestPlugin [ object, uuid("121574AA-841A-4FE0-871C-19A3C8C3C82F"), dual, pointer_default(unique) ] __interface ITestPlugin : IDispatch { [id(1) HRESULT Process(LONG val, [out,retval] LONG* retval); [id(2) HRESULT RegisterSource(ITestSrv* source); // <<<< Error points here }; // CTestPlugin [ coclass, threading("apartment"), vi_progid("Plug.TestPlugin"), progid("Plug.TestPlugin.1"), version(1.0), uuid("45D39585-BD2D-4F61-B0C7-A992F8CD8EF4"), helpstring("TestPlugin Class") ] .. ..
The error code is:c:\temp\code\chincb\chinplug\testplugin.h(19) : error MIDL2025 : syntax error : expecting a type specification near "ITestSrv"
c:\temp\code\chincb\chinplug\testplugin.h(19) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation
LINK : fatal error LNK1240: failed to compile IDL contentI'm scratching my hair out!
I Dream of Absolute Zero
-
This is really getting up my nose now. How do you, using ATL7 in VS7.1, expose an external COM interface to your COM implementation? If I import the type library (xxx.tlb), it complains of type definition. This is a snippet of what's in my header file. The error code generated is listed below Test.tlb is an external type library.
#import "Test.tlb" no_namespace // ITestPlugin [ object, uuid("121574AA-841A-4FE0-871C-19A3C8C3C82F"), dual, pointer_default(unique) ] __interface ITestPlugin : IDispatch { [id(1) HRESULT Process(LONG val, [out,retval] LONG* retval); [id(2) HRESULT RegisterSource(ITestSrv* source); // <<<< Error points here }; // CTestPlugin [ coclass, threading("apartment"), vi_progid("Plug.TestPlugin"), progid("Plug.TestPlugin.1"), version(1.0), uuid("45D39585-BD2D-4F61-B0C7-A992F8CD8EF4"), helpstring("TestPlugin Class") ] .. ..
The error code is:c:\temp\code\chincb\chinplug\testplugin.h(19) : error MIDL2025 : syntax error : expecting a type specification near "ITestSrv"
c:\temp\code\chincb\chinplug\testplugin.h(19) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation
LINK : fatal error LNK1240: failed to compile IDL contentI'm scratching my hair out!
I Dream of Absolute Zero
Although I do not know what is in the imported test.tlb, the error message means that the interface ITestSrv has not been defined. I would check where ITestSrv exists and is defined, and make sure that your header file can see the definition.