We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3530

Summary: Sdl uses a function i have defined for its own purposes
Product: SDL Reporter: Kaden Thomas <thomas.kaden4>
Component: mainAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: philipp.wiesemann, sezeroz
Version: 2.0.5   
Hardware: x86_64   
OS: Linux   

Description Kaden Thomas 2016-12-22 07:56:40 UTC
in my main.c file i have this function:

void read(void *env, uint8_t data)
{
	printf("%p : 0x%x\n", env, data);
}

What I found is that if I call SDL_Init(), data is printed using my function unless I mark the function as static or static inline.
Comment 1 Philipp Wiesemann 2016-12-22 20:54:22 UTC
read() is already available ("unistd.h", POSIX). The linking might get messed up if there are more functions with the same name (see also bug 2884).
Comment 2 Ozkan Sezer 2016-12-29 06:29:28 UTC
man 2 read

This must be closed as invalid.
Comment 3 Sam Lantinga 2017-01-02 03:00:29 UTC
Yes, you generally can't reimplement C library functions in your own program. The behavior is undefined on various platforms.