Managed Virtual method in Subclass IGNORED when parameter is Unman

G

Guest

Hello all,
We are using Managed and Unmanaged C++ code, on Windows XP SP2, VC++ .NET
2003.

In the SubClass we are trying to override a virtual method of the BaseClass
that has an unmanaged type parameter.

The problem is that the method call is always directed to the base class.


BaseClass and SubClass are in two different managed DLLs, but same namespace.
Map files were generated for both managed DLLs and the two methods have the
same signature.


Any help is appreciated.
Thanks.


public __gc class BaseClass
{
virtual bool TestVirtual(UnmanagedClass* pUnmanaged);
}

public __gc class SubClass : public BaseClass
{
bool TestVirtual(UnmanagedClass* pUnmanaged);
}
 
H

Holger Grund

Paul_P said:
BaseClass and SubClass are in two different managed DLLs, but same
namespace.
Map files were generated for both managed DLLs and the two methods have
the
same signature.

If types are defined by assemblies with different identies (as is true in
your case)
the types are different, too. You generally shouldn't use unmanaged types in
the public interface of your assemblies. You might want to use an opaque
type (such as void* or IntPtr etc.) since the metadata does not describe the
contents or layout of your type anyway.

If you really insist on that approach you should import the declarations
via #using instead of using a header file. That only works if your types
are visible outside the defining assembly (the default - at least in
VC++7.x -
for unmanaged types)

-hg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top