multiple modules & sdl

General FreeBASIC programming questions.
Post Reply
irrit8or
Posts: 21
Joined: May 27, 2005 6:21
Location: Under my rock..waiting..

multiple modules & sdl

Post by irrit8or »

hi,

i have multiple module (.bas files) open in fbide 0.4 with fb 0.14.

certain modules like draw the mouse, animation etc..

how should i go about initializng sdl, blitiing, etc..
currently i run into many error & craches passing pointers & stuff around...

thanx
Shadowwolf
Posts: 341
Joined: May 27, 2005 7:01
Location: Canada
Contact:

Post by Shadowwolf »

need more detail in what wrong.

this most likely won't help much but you should init sdl at your entry point model.
v1ctor
Site Admin
Posts: 3804
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Post by v1ctor »

Well, you need a main module, that will call the functions on each module to do the initializations.

FB will make the first .bas file passed to command line the main module.

Try not use inter-module global vars and arrays, but if they are really needed, use COMMON to share them.

Always use OPTION EXPLICIT on each source file, any typo on a global var and things can start to not work.

Don't put dynamic arrays in module level (outside functions) if it's not the main module, the arrays will never be allocated (as in QB). If you have global dynamic arrays, declare them as "dim shared myarray() as sometype" in the module level and allocate the array inside an Init or so function using "redim myarray(lower to upper)" etc.
1000101
Posts: 2556
Joined: Jun 13, 2005 23:14
Location: SK, Canada

Post by 1000101 »

*bump*
Mysoft
Posts: 836
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Post by Mysoft »

why fb 0.14?
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Post by counting_pine »

It was probably the best version available at the time the post was written. Why it's been bumped now is anyone's guess...
notthecheatr
Posts: 1759
Joined: May 23, 2007 21:52
Location: Cut Bank, MT
Contact:

Post by notthecheatr »

Maybe he just bumped it to be random.
Mysoft
Posts: 836
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Post by Mysoft »

ha... i forget to check the date ;P
v1ctor
Site Admin
Posts: 3804
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Post by v1ctor »

And the last paragraph i wrote doesn't apply anymore (since v0.15). Anything in module-level of other modules than main will be executed - thanks to the magic global constructors.
Post Reply