Making a reference instance of DirectX window handler?

Posted 03 August 2013 - 04:41 PM

The Problem: I'm trying to use my fontwrapper I created in my new framework, but the draw function requires me to pass in the window handler so it knows what to write to. The problem here is that my window handler is in a separate file, "EntryPoint.cpp" to be exact. Now I already externalized it and linked the header file associated with main window handler so I can make the argument pass into the drawtext function.

The issue is that when I pass it in, and compile I am getting a linker error.

I compiled the code without making the call to drawtext and passing the variable and it compiles and runs appropiately.
The drawtext function for my fontwrapper works fine in the EntryPoint.cpp file, but the problem is that I need to make the calls in a different file due to the structure of the program. (Waaay too much code to implement into one massive file!)

Now I was thinking of making a reference to the main window object:

HWND g_hMainWnd;

Though I honestly do not know how. Another idea that came up is why I am getting a linker error when the window object is properly externalized?

I am unsure of exactly how to proceed.

To be clear, I do know how to make pointers, and references, though I do not know if its possible to actually make a reference of an object that is already created to pass to a function that requires it as a target parameter.

Heres some of the code (It only shows relevant code, all unneeded code was gutted for sake of clarity):

Re: Making a reference instance of DirectX window handler?

Posted 04 August 2013 - 10:54 AM

Yeah, that's exactly why the linker got confused. It is working like a charm now. Didn't do much functionality last night as I fixed it right before I hit the sack, but I can't believe I didn't see what I did wrong. The joys of programming!