Overriding functions with an unmanaged return types

  • Thread starter Thread starter Grant Frisken
  • Start date Start date
G

Grant Frisken

I have a function in a Managed C++ base class which looks something like:

public __gc class Foo
{
virtual A* Bar(B* b, C*c);
};

where A is an unmanaged class and B and C are managed classes.

If I create a derived class in the same DLL as class Foo and override
function Bar then everthing works as expected.
If however I import the DLL into another C++ DLL and attempt to override the
function (in exactly the same way) it does not work. That is everything
compiles OK (provided I ensure that the importing module includes the same
definition of unmanaged class A, but when you run the code the base function
is called not the overriden function.

I'm thinking that this must be something to do with the unmanaged return
type because I can successfully override other functions in this same
configuration.

Anyone out there have any ideas?

Grant Frisken
 
I'm thinking that this must be something to do with the unmanaged return
type because I can successfully override other functions in this same
configuration.

Hi Grant,

Thank you for reporting the problem. The issue here is that the native
types in the DLL and EXE are treated as two different types. I have entered
a bug in our database.
 

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

Back
Top