Segmentation faults and certain windows equivalents

Hi all,
What are some tips to abide by when using SDL that will help avoid segmentation faults and the windows eqivalents (unhandled exceptions where the program goes for memory that isn’t there)?
Every program I write with SDL generates these when I start using SDL outside of the main function. For instance writting an init() function that wraps SDL initialization and the setting of video modes…or writting a function that opens a bunch of images. It just seems that unless I copy code from my “Programming Linux Games” book directly I always get segmentation faults (and the windows equivalent).
I’m a self-taught programmer and I understand that without seeing my code you might have trouble answering this question. If you’d like to see a program I’ve built but can’t run, just ask and I’ll send it. Either way…
What are some big guidelines that I should follow? Maybe they are standards I haven’t heard of or maybe they’re are just things I haven’t learned about the library yet.
I’d appreciate all comments and suggestions.
Thank you,
Chip Collier

Just a quick question.

You aren’t calling any SDL functions before initing SDL are you? That
includes the SDL event loop.> ----- Original Message -----

From: Chip Collier
To: sdl at libsdl.org
Sent: Saturday, January 05, 2002 9:25 PM
Subject: [SDL] Segmentation faults and certain windows equivalents

Hi all,
What are some tips to abide by when using SDL that will help avoid
segmentation faults and the windows eqivalents (unhandled exceptions where
the program goes for memory that i sn’t there)?
Every program I write with SDL generates these when I start using SDL
outside of the main function. For instance writting an init() function that
wraps SDL initialization and the setting of video modes…or writting a
function that opens a bunch of images. It just seems that unless I copy code
from my “Programming Linux Games” book directly I always get segmentation
faults (and the windows equivalent).
I’m a self-taught programmer and I understand that without seeing my code
you might have trouble answering this question. If you’d like to see a
program I’ve built but can’t run, just ask and I’ll send it. Either way…
What are some big guidelines that I should follow? Maybe they are standards
I haven’t heard of or maybe they’re are just things I haven’t learned about
the library yet.
I’d appreciate all comme nts and suggestions.
Thank you,
Chip Collier