Wrong Virtual Function Called

I am having an issue with the wrong virtual function being called by C++. I did a clean and rebuild, but it still keeps happening.

Here is the reference structure:
CLIScumm (C++/CLI) -> NativeScummWrapper -> ScummVM

CLIScumm creates an instance of nativeScummWrapperOSystem (defined in nativeScummWrapper) and sets an external variable (defined in ScummVM) to it. nativeScummWrapperOSystem inherits from OSystem defined in ScummVM.

This line in ScummVM:

 
FilesystemFactory *factory = g_system->getFilesystemFactory();


This calls NativeScummWrapperOSystem::logMessage when it should be calling OSystem::getFilesystemFactory.

CliScrumm constructs an instance of FSNode (defined in ScummVM). It is in the constructor of that type that problematic line is called.

Clues:
I have been using VisualStudio references to link the projects. I noticed that the reference for ScummVM in NativeScummWrapper has a yellow exclaimation mark and the full path has this error listed:
The "Microsoft.VisualStudio.ProjectSystem.References.UnresolvedBuildDependencyProjectReference" reference could not be resolved.

This could be the culprit but I am unsure.

In the method that calls the method which calls getFilesystemFactory (defined in CLIScumm) there is another call to a different method on the same nativeScummWrapperOSystem instance. This works.

Please let me know what other code I should show you; as this is a big project I am mindful not to paste massive blobs of code into the forum.

Last edited on
Remove the reference with the yellow exclamation mark and add it again.
No luck, removing it had no effect. There is still the yellow exclamation mark and still the same issue.

Do you think that the yellow exclamation mark reference is the likely culprit?
Last edited on
Not sure if this is the main problem but it shows that sth. is wrong.
Reloading 'NativeScummWrapper' made the yellow exclamation mark go, but I still have the same issue.
Have you checked that the assembly DLL in the EXE folder has been correctly updated? It is behaving like the assembly you are referencing is the not the same as the one being used by your app, so could be worth (re)checking?.

If you're not sure, open the suspect assembly using ildasm and see how NativeScummWrapperOSystem is defined.

Andy
I wasn't clear sorry. NativeScummWrapper and ScummVM are both native C++. CLIScumm is written in C++/CLI.
When I get out of work later today I double check the references though . . .
Adding to my previous post. I am suspecting you could be on the right track andywestken. I am shifting previously working code to a new solution, restructuring it and updating ScummVM. There may be some link to the old code base somewhere . . .
Please don't put into too much effort into this now. I have be forced to turn to hired help.

When the hired hand fixes it for me, I will post the solution here.
Last edited on
Topic archived. No new replies allowed.