Home › Forums › C++ Programming › Why Is The Wrong Function Being Called
Tagged: C++ C++ CLI Visual C++
- This topic has 1 reply, 2 voices, and was last updated 4 years, 6 months ago by M. Saqib.
- AuthorPosts
- May 30, 2020 at 6:36 pm #7472AnonymousInactive
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.
I am using ScummVM as a library, in a personal project. It worked before I upgraded to the latest ScummVM but failed after.
I tried blowing away the changes which caused it to break and starting again, but I still had the issue.
Here is the reference structure:
CLIScumm (C++/CLI) -> NativeScummWrapper (Native C++) -> ScummVMCLIScumm 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:
As far as I am aware it is only that method which is the problem, other methods on both the base and super classes can be called without issue.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.
- This topic was modified 4 years, 6 months ago by .
- This topic was modified 4 years, 6 months ago by .
- June 9, 2020 at 1:03 am #7626M. SaqibKeymaster
Can you share the error log or call stack so that I can better look into this.
This calls NativeScummWrapperOSystem::logMessage when it should be calling OSystem::getFilesystemFactory.
May be the ScummVM library is calling the incorrect method internally.
No idea unless you share call stack or error logs you see in the IDE.
- AuthorPosts
- The forum ‘C++ Programming’ is closed to new topics and replies.