Calling method in referenced DLL failed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ApocDev
    New Member
    • Apr 2009
    • 8

    Calling method in referenced DLL failed

    I've got a program that hooks 'EndScene' of a D3D device via native code, with a C++/CLI wrapper to inject into the process (think of an application such as Fraps, or other game video capture apps).

    The C++/CLI wrapper loads my assembly, and calls a statically named method (OnFrame) every time EndScene is called from within the game. There is no issues with the C++/CLI wrapper, or the invocation, that all works fine and dandy.

    The issue comes from the call within the OnFrame method in my assembly.

    Code:
            private static uint _frameCount;
            public static void OnFrame()
            {
                Logging.Write("OnFrame " + _frameCount++);
                Common.Engine.Pulse();
            }
    Engine.Pulse() resides in another DLL. (In this case; Onyx.Common.dll )

    OnFrame is called each frame (as per the debug message), however, Common.Engine.P ulse() is never actually called.

    Code:
            public static void Pulse()
            {
                Logging.Write("ENGINE PULSE");
            }
    Logging resides in yet another DLL, and everything else in the Onyx.Common.dll is perfectly able to make calls to the Logging class. (Logging is just an event based wrapper so I can display messages on my main window)

    Is there something I'm missing? Or just a random bug, etc?
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    The issue comes from the call within the OnFrame method in my assembly.
    And what is that issue? You never said the error message you're getting.

    Comment

    • ApocDev
      New Member
      • Apr 2009
      • 8

      #3
      Engine.Pulse(); is never called. It seems like it hits the Engine.Pulse() method, then just dies.

      Comment

      • tlhintoq
        Recognized Expert Specialist
        • Mar 2008
        • 3532

        #4
        (Logging is just an event based wrapper so I can display messages on my main window)
        Are these happening in different threads? If you are trying to access a control on your main window from a thread that didn't create it, it will break.

        Comment

        • ApocDev
          New Member
          • Apr 2009
          • 8

          #5
          Originally posted by tlhintoq
          Are these happening in different threads? If you are trying to access a control on your main window from a thread that didn't create it, it will break.
          Like I said, Logging is an event based wrapper. It's threadsafe, and coded specifically to make logging to the GUI thread easier. (It fires an event, which is handled in the main form, which then does all the invoking to make sure it adds the new text on the GUI thread.)

          Comment

          • tlhintoq
            Recognized Expert Specialist
            • Mar 2008
            • 3532

            #6
            Sounds allot like how I do my own.

            Make sure its really hitting that code?
            Code:
            public static void Pulse()
                    {
            Console.WriteLine("Pre log write");
                        Logging.Write("ENGINE PULSE");
            Console.WriteLIne("Post log write");
                    }

            Comment

            • ApocDev
              New Member
              • Apr 2009
              • 8

              #7
              Originally posted by tlhintoq
              Sounds allot like how I do my own.

              Make sure its really hitting that code?
              Code:
              public static void Pulse()
                      {
              Console.WriteLine("Pre log write");
                          Logging.Write("ENGINE PULSE");
              Console.WriteLIne("Post log write");
                      }
              Already did that, still nothing.

              It's odd, I changed the call to another method in the same class, and it worked just fine. Gotta love weird bugs.

              Comment

              • tlhintoq
                Recognized Expert Specialist
                • Mar 2008
                • 3532

                #8
                Originally posted by ApocDev
                Already did that, still nothing.

                It's odd, I changed the call to another method in the same class, and it worked just fine. Gotta love weird bugs.
                Still nothing... Does that mean it doesn't even write the pre-call line?

                Does the other call give you the functions you need? Are you all good now?

                Comment

                • ApocDev
                  New Member
                  • Apr 2009
                  • 8

                  #9
                  The pre-call write line worked, however, the writeline within Engine.Pulse and the write after Engine.Pulse were never called.

                  Also, yes, I'm fine now. Just a very strange bug.

                  Comment

                  Working...