SDL digest, Vol 1 #456 - 27 msgs

Message: 20

I have located the cause of my odd problem, but I don’t understand
it. I have a function in the main program file (not called in the
testing version) named shutdown(). If I rename it, e.g. to
Shutdown(), the problem goes away. I know that shutdown is a system
command, but it hadn’t occurred to me that I couldn’t use the name
in my code.

shutdown() is also the name of a semi-standard socket function; see
<sys/socket.h>.

Aha! This is a trap for young players - the symptoms were bizarre, and
it was a bit flukey that I found the cause. I am rather surprised that
the compiler didn’t tell me anything about this. Do I need to be
familiar with all the functions in /usr/include, or is there another way
to check for name clashes? I’m not using any socket stuff, but I
presume it is in the SDL library.

Gib> Date: Wed, 24 Jul 2002 03:38:13 -0700 (PDT)

From: Brian Raiter
To: sdl at libsdl.org
Subject: Re: [SDL] Shared library, SDL etc. not the issue
Reply-To: sdl at libsdl.org

Behalf Of Gib
Bogle

Message: 20

I have located the cause of my odd problem, but I don’t understand
it. I have a function in the main program file (not called in the
testing version) named shutdown(). If I rename it, e.g. to
Shutdown(), the problem goes away. I know that shutdown
is a system

command, but it hadn’t occurred to me that I couldn’t use the name
in my code.

shutdown() is also the name of a semi-standard socket function; see
<sys/socket.h>.

Aha! This is a trap for young players - the symptoms were
bizarre, and
it was a bit flukey that I found the cause. I am rather
surprised that
the compiler didn’t tell me anything about this. Do I need to be
familiar with all the functions in /usr/include, or is there
another way
to check for name clashes? I’m not using any socket stuff, but I
presume it is in the SDL library.

Gib

Well, you do have to live with it. That’s a problem related to
the way compilers/linkers work for the C/C++ languages.

If you use a function that is also available in the libraries the
linker might not like it. Always make your non public functions, static.> -----Original Message-----

From: sdl-admin at libsdl.org [mailto:sdl-admin at libsdl.org]On
Sent: quarta-feira, 24 de Julho de 2002 22:51
To: sdl at libsdl.org
Subject: [SDL] Re: SDL digest, Vol 1 #456 - 27 msgs

Date: Wed, 24 Jul 2002 03:38:13 -0700 (PDT)
From: Brian Raiter
To: sdl at libsdl.org
Subject: Re: [SDL] Shared library, SDL etc. not the issue
Reply-To: sdl at libsdl.org


Paulo Pinto