Sidewinder wrote:
Does changing the pointer name cause the problem to go away?
struct GfxBase *GraphicsBase = 0;
GraphicsBase = (struct GfxBase *)OpenLibrary("graphics.library", 39);
I tried out the code on my StormC 4 setup and could not duplicate the error. Also, which line is the error reported on?
Hi Sidewinder,
Well, some things I should point out. Firstly, the compiler wasn't operating in gcc mode - it was still in stormc3 mode. The reason for this is that I'm updating some older code (in stages) that was storm3 dependent up through stormgcc and ultimately to gcc.
Now, the error is reported on the line where I OpenLibrary() the graphics.library, not on the line where I declare the library base pointer.
Changing the pointer name does indeed eliminate the problem, but I didn't want to do this lest it causes problems later - especially when the library base names are used in some of the linker libraries...
Now, having looked closer at the proto/ headers, I think I may have found why the IntuitionBase one works and not GfxBase.
Where I use IntuitionBase, the only thing the compiler has seen up to that point is
in proto/intuition.h
extern struct IntuitionBase* IntuitionBase;
in my code
struct IntuitionBase* IntuitionBase = 0;
It hasn't yet seen the definition of struct IntuitionBase, but is happy that we are just "assigning a pointer to struct" type stuff.
Now, in the code that uses GfxBase, I think before my code is reached, at some instance, the actual struct GfxBase definition is exposed. Hence, when it sees the OpenLibrary(), it sees
GfxBase = (struct GfxBase*)OpenLibrary...;
and as soon as it sees GfxBase, it is expecting the declaration of an object of that type.
Hmm, I should try
::GfxBase = ....
I wonder...
-edit-
Incidentally, have you noticed any lockups with StormED 4 + magic menu?