Why Is The Wrong Function Being Called

Home Forums C++ Programming Why Is The Wrong Function Being Called

Viewing 1 reply thread
  • Author
    Posts
    • #7472
      Manannan
      Participant

      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++) -> 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:
      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 5 months, 4 weeks ago by Manannan.
      • This topic was modified 5 months, 4 weeks ago by Manannan.

    • #7626
      M. Saqib
      Keymaster

      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.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.