It will not work importing both.  I import both with no_namespace, but the second 
#import generates lots of __missing_type errors.  It looks like this:

#import "mscorlib.tlb" raw_interfaces_only
#import "eshopbase.tlb" no_namespace        
#import "eshopbusiness.tlb" no_namespace

One problem is that the generated typelibrary doesn't reference the typelibrary 
containing the types, which seems to be a bug in the tlbexp tool?  It does generate a 
reference to mscorlib.tlb so it will be included in the resulting .tlh file.  

-- 
- Petter Nilsen, [EMAIL PROTECTED]
Technical Manager, Internet Development, Visma Software ASA


> -----Opprinnelig melding-----
> Fra: Mattias Sjögren [mailto:[EMAIL PROTECTED]]
> Sendt: 22. desember 2002 02:46
> Til: [EMAIL PROTECTED]
> Emne: Re: [ADVANCED-DOTNET] enums in typelibs
> 
> 
> Petter,
> 
> >I have an enum and a baseclass in a namespace, and a derived class 
> >returning the enum in another namespace. THe problem is that when I 
> >generate the .tlb files for the COM wrapper code, the enum 
> from the first 
> >namespace is not in the tlb for the derived class, so I get 
> an error when 
> >using #import on that tlb from C++.  Is it possible to force 
> an enum to be 
> >part of another namespace or tlb?
> 
> When you say namespace, don't you really mean assembly? Which 
> namespace the 
> types are in have little meaning when it comes to COM interop.
> 
> When you export a class that depends on types in another 
> assembly, the type 
> library exporter should generate typelibs for the depenencies 
> as well. In 
> your case, you should have one TLB file for the assembly with 
> the base 
> class and enum, and one for the derived class. As long as you 
> #import both 
> in the C++ code, it should work.
> 
> 
> >Is it possible to generate a single tlb file for both the 
> baseclass with 
> >the enum and the derived class?
> 
> Not if they are in different assemblies, no. Unless you 
> manually decompile 
> the typelibs with OleView, copy & paste the defs into a 
> common IDL file and 
> compile into a new TLB.
> 
> 
> Mattias
> 
> ===
> Mattias Sjögren
> [EMAIL PROTECTED]
> 
> You can read messages from the Advanced DOTNET archive, 
> unsubscribe from Advanced DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.
> 

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to