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 4192

Summary: Define replacement __iob_func() in header to avoid VS linker errors when mixing versions
Product: SDL Reporter: Andreas Schiffler <aschiffler>
Component: buildAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: trivial    
Priority: P2    
Version: don't know   
Hardware: x86   
OS: Windows 10   

Description Andreas Schiffler 2018-06-08 14:42:30 UTC
As per
https://stackoverflow.com/questions/30412951/unresolved-external-symbol-imp-fprintf-and-imp-iob-func-sdl2
the __iob_func is not defined anymore which leads to a link error when using a .lib file compiled with previous versions of Visual Studio.

People are hitting this when compiling against SDL2Test, i.e. see here: http://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/#comment-94

A fix would be largely cosmetic: add a compile time check and replacement definition such as

FILE _iob[] = {*stdin, *stdout, *stderr};
extern "C" FILE * __cdecl __iob_func(void)
{
    return _iob;
}

to a SDL header.
Comment 1 Sam Lantinga 2019-06-18 15:37:48 UTC
SDL 2.0.10 release is now built with Visual Studio 2017.