HighTechTalks DotNet Forums  

tlbimp importing COM interface params as if they were locally defi

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss tlbimp importing COM interface params as if they were locally defi in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Sean Hokanson
 
Posts: n/a

Default tlbimp importing COM interface params as if they were locally defi - 11-06-2007 , 01:46 PM






I have an .idl file that defines an interface with a method that takes
another (externally-defined) interface pointer as a parameter (see example
tmp.idl file below, where ITmp:OM takes an IXMLDOMDocument pointer). When I
run midl.exe to generate the .tlb, then run tlbimp.exe on that .tlb, the
produced interop assembly includes the externally-defined interface in its
own namespace. For example, using the sample tmp.idl file below and doing the
following (using VS2005 tools):

Quote:
midl tmp.idl
tlbimp tmp.tlb /out:tmp.wrapper.dll
ildasm tmp.wrapper.dll
ildasm shows that the assembly includes a bunch of the MSXML types and
interfaces in the tmp.wrapper namespace. Is there a way to prevent this so
the assembly only includes the types "locally" defined? The reason I ask is
because when we use this assembly in a C# project that also references the
assembly that actually defines those types (in this case, msxml via its own
interop assembly), we end up having to cast IXMLDOMDocument (and other)
variables back and forth between the namespaces, even though they are
actually the same type.

Using the /reference or /tlbreference switches on tlbimp have no effect.

I'm happy to provide more info if needed.

// ***** tmp.idl file ***********
import "ocidl.idl";
[
object,
uuid(897212B0-ECBB-11D4-B6C4-0090277BEE17),
pointer_default(unique)
]
interface ITmp : IUnknown
{
[propput] HRESULT DOM([in] IXMLDOMDocument* pIXMLDOMDocument);
};
[
uuid(7FD845E9-EB24-11D4-B6C3-0090277BEE17),
version(1.0)
]
library TMPLib
{
[
uuid(897212B1-ECBB-11D4-B6C4-0090277BEE17)
]
coclass Tmp
{
[default] interface ITmp;
};
};



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.