Page 1 of 1

Problem with gslib

Posted: Tue Aug 31, 2004 11:55 pm
by BiB
I am making a little sample using GsLib and i have a problem.

First, I declare a gsDriver object :

Code: Select all

gsDriver GS;
but when i want to do something with it, the prog hangs.

For example :

Code: Select all

GS.setDisplayMode(.......);


I saw that when i put the declaration inside a function, it works.

But i want to use the same gsDriver in many functions. How can I do it ?

It seems that the gsDriver is not correctly if defined outside a function.

Any idea is welocme :wink:

Posted: Wed Sep 01, 2004 4:40 am
by t0mb0la
Just a guess, but perhaps you need to call _init at the start of your main.

Code: Select all

extern "C" { void _init(void); }

int main(int argc, char **argv)
{
 _init();
 .
 .
 .
}

Posted: Wed Sep 01, 2004 7:07 am
by BiB
I saw that you did that for altimit but i don't understand this thing.

Can you explain me what this call does ?

Thanks

Re: Problem with gslib

Posted: Wed Sep 15, 2004 11:30 am
by MrSiir[S]
BiB wrote:I saw that when i put the declaration inside a function, it works.
But i want to use the same gsDriver in many functions. How can I do it ?
It seems that the gsDriver is not correctly if defined outside a function.
Any idea is welocme :wink:
Test this:

Code: Select all

// outside functions (global var)
gsDriver* myGsDriver;

// in main
int main()
{
	myGsDriver = new gsDriver;
	myGsDriver->setDisplayMode(
	....
}

// In other function
void foo()
{
	myGsDriver->drawPipe.RectFlat(0,0,100,100,0,black);
}