| View previous topic :: View next topic |
| Author |
Message |
BiB
Joined: 27 Feb 2004 Posts: 36 Location: France
|
Posted: Tue Aug 31, 2004 11:55 pm Post subject: Problem with gslib |
|
|
I am making a little sample using GsLib and i have a problem.
First, I declare a gsDriver object :
but when i want to do something with it, the prog hangs.
For example :
| Code: |
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: |
|
| Back to top |
|
 |
t0mb0la
Joined: 20 Jan 2004 Posts: 24 Location: Seattle WA, USA
|
Posted: Wed Sep 01, 2004 4:40 am Post subject: |
|
|
Just a guess, but perhaps you need to call _init at the start of your main.
| Code: | extern "C" { void _init(void); }
int main(int argc, char **argv)
{
_init();
.
.
.
} |
|
|
| Back to top |
|
 |
BiB
Joined: 27 Feb 2004 Posts: 36 Location: France
|
Posted: Wed Sep 01, 2004 7:07 am Post subject: |
|
|
I saw that you did that for altimit but i don't understand this thing.
Can you explain me what this call does ?
Thanks |
|
| Back to top |
|
 |
MrSiir[S]
Joined: 14 Sep 2004 Posts: 32
|
Posted: Wed Sep 15, 2004 11:30 am Post subject: Re: Problem with gslib |
|
|
| 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: |
// 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);
}
|
|
|
| Back to top |
|
 |
|