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 - Define replacement __iob_func() in header to avoid VS linker errors when mixing versions
Summary: Define replacement __iob_func() in header to avoid VS linker errors when mixi...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: build (show other bugs)
Version: don't know
Hardware: x86 Windows 10
: P2 trivial
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-08 14:42 UTC by Andreas Schiffler
Modified: 2019-06-18 15:37 UTC (History)
0 users

See Also:


Attachments

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