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 - Sdl uses a function i have defined for its own purposes
Summary: Sdl uses a function i have defined for its own purposes
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: main (show other bugs)
Version: 2.0.5
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-22 07:56 UTC by Kaden Thomas
Modified: 2017-01-02 03:00 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.