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.


Reply via email to