Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug in 2003 c++ compiler - Microsoft guys, please respond!

1 view
Skip to first unread message

Carlos Fernandez

unread,
Feb 27, 2004, 5:36:06 PM2/27/04
to
Note: More evidence that the below scenario is a compiler bug is that it works when compiled as a static lib; it only fails as a .dll.
---------------------
Define a managed class with a method that takes a template parameter:

public __gc class UtilClass {
public:
UtilClass();

void ConvertSomething( System::String *inString, NativeClass<int>&outType );
};

When you build, there will be no errors.

Now build another MC++ library, and reference the library with the class described above:

public __gc class LegacyWrapper {
public:
LegacyWrapper();

void DoSomething( System::String *inString ); // calls UtilClass::ConvertSomething
};

To get the second library to compile, you must include the definitions of any native types used by the library you are referencing (which is in this case, the template class NativeType). This is expected, just like using a dll that uses a class that it does not export, you must get the definitions somewhere.

However, in this case, you'll notice that no matter what you do the compiler refuses to believe that NativeType has been included.

Notice also, that this is *not* the case if you replace the template native type with any old non-template native (i.e. non gc) class. Then it works just fine.

Is there something I am missing??!?

0 new messages