Well I went back and had a look at how my panels are created and ended up
with this:
Globals.cpp:
static PD_GlobalDataInterface stat_PDGlobals; // creates
the static instant of the handler for the class
IPDGlobal* PDGlobalsI = (IPDGlobal*)&stat_PDGlobals; // creates
an interface for this (something we can call)
PD_GlobalData *g_PDGlobals; //
holds the direct pointer to the class
Globals.h:
extern IPDGlobal* PDGlobalsI;
extern PD_GlobalData *g_PDGlobals;
cdll_client_int.cpp:
if ( (g_PDGlobals = (PD_GlobalData *)PDGlobalsI->Create()) == NULL )
//creates the class and sets up the global pointer
return false;
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Peloski
Sent: Wednesday, December 12, 2007 4:56 AM
To: [email protected]
Subject: Re: [hlcoders] Vis 2005 error
--
[ Picked text/plain from multipart/alternative ]
It's kind of funny that it works in 2003. I'm with Jay, from what you've
shown it doesn't look like that code should work in any compiler.
typedef PD_GlobalData* PD_GlobalDataInterface;
Would make more sense at least.
Regards,
Paul
On Dec 11, 2007 1:39 PM, Jay Stelly <[EMAIL PROTECTED]> wrote:
> The compiler appears to be correct. You haven't told us what
> PD_GlobalData is (struct/class/typedef?). Unless PD_GlobalDataInterface
> is a typedef of PD_GlobalData I can't see how this is valid.
>
> Let's say PD_GlobalDataInterace is a subclass of PD_GlobalData (what I'd
> guess from your arrangement anyway):
>
> class PD_GlobalData
> {};
>
> class PD_GlobalDataInterface : public PD_GlobalData
> {};
>
> then you could do this:
>
> extern PD_GlobalData *g_PDGlobals;
>
> static PD_GlobalDataInterface g_PDGlobalInterface;
> PD_GlobalData *g_PDGlobals = &g_PDGlobalInterface;
>
>
>
> But they have to be consistent types (that includes whether or not
> you're using a pointer) and you can't put a static in a header file and
> expect to access it in other modules (static means it's local to one
> module. So you have two type errors and a scope error in the first bit
> of code. The second bit removes one of the type errors, but you've
> still got the other two errors.
>
> Anyway I'm just guessing since I haven't seen the rest of the code.
> This isn't a VS2005 issue - the code is not consistent.
>
> Jay
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Mark
> Chandler
> Sent: Tuesday, December 11, 2007 9:55 AM
> To: [email protected]
> Subject: [hlcoders] Vis 2005 error
>
> This is a multipart message in MIME format.
> --
> [ Picked text/plain from multipart/alternative ]
> I recently moved some code from a 2003 mod to a 2005 mod (vis im talking
> about here) and besides the new compile sads at some syntax im getting
> one
> major error. It doesn't like me making a static class handle (which gets
> init elsewhere).
>
> Ok in my h file I declared it as extern so any class including that file
> can
> use it. It looks like so:
> extern PD_GlobalData *g_PDGlobals;
>
> Now in my cpp file I have it declared as:
> static PD_GlobalDataInterface (g_PDGlobals);
>
> Then when trying to compile I get the error:
> pd_globaldata.cpp(126) : error C2040: 'g_PDGlobals' :
> 'PD_GlobalDataInterface' differs in levels of indirection from
> 'PD_GlobalData *'
>
> Now I think this is caused by one being a pointer and the other not. But
> when I remove the * from extern it has a bigger sad:
> pd_globaldata.cpp(126) : error C2371: 'g_PDGlobals' : redefinition;
> different basic types
> PD_GlobalData.h(59) : see declaration of 'g_PDGlobals'
>
> Any ideas of how to fix this? This code ran fine under vis 2003.
>
> Mark [Lodle]
> --
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>
--
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders