debian/sdl2-config.1
author Sam Lantinga <slouken@libsdl.org>
Fri, 28 Nov 2014 04:51:33 -0800
changeset 9246 a761913e5e91
parent 6886 55fc95e5817b
permissions -rw-r--r--
Fixed bug 2786 - "UCS-2-INTERNAL" iconv encoding is not supported everywhere, use UTF-16LE instead

Jonas Kulla

src/main/windows/SDL_windows_main.c:137:
cmdline = SDL_iconv_string("UTF-8", "UCS-2-INTERNAL", (char *)(text), (SDL_wcslen(text)+1)*sizeof(WCHAR));

I'm trying to compile an SDL2 application for windows using the mingw-w64 32bit toolchain provided by my distro (Fedora 19). However, even the simplest test program that does nothing at all fails to startup with a "Fatal error - out of memory" message because the mingw iconv library provided by my distro does not support the "UCS-2-INTERNAL" encoding and the conversion returns null.

From my little bit of research, it turns out that even though this encoding is supported by the external GNU libiconv library, some glibc versions (?) don't support it with their internal iconv routines, and will instead provide the native endian encoding when "UCS-2" is specified.

Nonetheless, I wonder why the native endianness is considered in the first place when Windows doesn't even run on any big endian archs (to my knowledge). And true enough, 'WIN_StringToUTF8' from core/windows/SDL_windows.h is used everywhere else in the windows backend, which is just a macro to iconv with "UTF-16LE" as source. Therefore it would IMO make sense to use this macro here as well, which would solve my problem (patch attached).
slouken@6886
     1
.TH sdl2-config 1 "2012-02-20" "SDL 2.0"
slouken@6886
     2
.SH NAME
slouken@6886
     3
sdl2-config \- script to get information about the installed version of SDL
slouken@6886
     4
.SH SYNOPSIS
slouken@6886
     5
.B sdl2-config
slouken@6886
     6
[ --prefix=
slouken@6886
     7
.IR DIR ]
slouken@6886
     8
[ --exec-prefix=
slouken@6886
     9
.IR DIR ]
slouken@6886
    10
[ --version ] [ --libs | --library-libs | --plugin-libs ] [ --cflags ]
slouken@6886
    11
.SH DESCRIPTION
slouken@6886
    12
.B sdl2-config
slouken@6886
    13
is a tool that is used to configure and determine the compiler and linker
slouken@6886
    14
flags that should be used to compile and link programs, libraries, and
slouken@6886
    15
plugins that use SDL.  It is also used internally by the m4 macros that are
slouken@6886
    16
included with SDL.
slouken@6886
    17
.SH OPTIONS
slouken@6886
    18
.TP
slouken@6886
    19
.B --cflags
slouken@6886
    20
Print the compiler flags that are necessary to compile a program or library
slouken@6886
    21
that uses SDL.
slouken@6886
    22
.TP
slouken@6886
    23
.BI --exec-prefix= DIR
slouken@6886
    24
If specified, use
slouken@6886
    25
.I DIR
slouken@6886
    26
instead of the installation exec prefix that SDL was build with when
slouken@6886
    27
computing the output for the --cflags, --libs, --library-libs, and
slouken@6886
    28
--plugin-libs options.  This option must be specified before any of the
slouken@6886
    29
--cflags, --libs, --library-libs, and --plugin-libs options.
slouken@6886
    30
.TP
slouken@6886
    31
.B --libs
slouken@6886
    32
Print the linker flags that are necessary to link a program that uses SDL.
slouken@6886
    33
.TP
slouken@6886
    34
.B --static-libs
slouken@6886
    35
Print the linker flags that are necessary to statically link a program that uses SDL.
slouken@6886
    36
.TP
slouken@6886
    37
.B --library-libs
slouken@6886
    38
Print the linker flags that are necessary to link a library that uses SDL.
slouken@6886
    39
(This excludes any static objects required for linking, since these must be
slouken@6886
    40
linked only by executable programs.)
slouken@6886
    41
.TP
slouken@6886
    42
.B --plugin-libs
slouken@6886
    43
Print the linker flags that are necessary to link an SDL-using object that
slouken@6886
    44
is to be accessed via
slouken@6886
    45
.IR dlopen (3).
slouken@6886
    46
This may include static objects with PIC symbol information.  This option
slouken@6886
    47
should
slouken@6886
    48
.B not
slouken@6886
    49
be used for ordinary shared libraries or standalone applications.
slouken@6886
    50
.TP
slouken@6886
    51
.BI --prefix= DIR
slouken@6886
    52
If specified, use PREFIX instead of the installation prefix that SDL was
slouken@6886
    53
built with when computing the output for the --cflags, --libs,
slouken@6886
    54
--library-libs, and --plugin-libs options.  This option is also used for
slouken@6886
    55
the exec prefix if --exec-prefix was not specified.  This option must be
slouken@6886
    56
specified before any of the --cflags, --libs, --library-libs, and
slouken@6886
    57
--plugin-libs options.
slouken@6886
    58
.TP
slouken@6886
    59
.B --version
slouken@6886
    60
Prints the currently installed version of SDL on standard output.
slouken@6886
    61
.SH EXAMPLES
slouken@6886
    62
.TP
slouken@6886
    63
gcc -o main.o $(sdl2-config --cflags) main.c
slouken@6886
    64
is how you might use
slouken@6886
    65
.B sdl2-config
slouken@6886
    66
to compile a C source file for an executable program.
slouken@6886
    67
.TP
slouken@6886
    68
gcc -o my_app $(sdl2-config --libs) main.o util.o
slouken@6886
    69
is how you might use
slouken@6886
    70
.B sdl2-config
slouken@6886
    71
to link compiled objects into an executable program.
slouken@6886
    72
.TP
slouken@6886
    73
gcc -o libSDL_nifty-2.0.so.0.0.1 $(sdl --library-libs) read.o write.o munge.o
slouken@6886
    74
is how you might use
slouken@6886
    75
.B sdl2-config
slouken@6886
    76
to link compiled objects into a shared library.
slouken@6886
    77
.TP
slouken@6886
    78
gcc -o libnifty_xmms.so $(sdl --plugin-libs) stream.o blit.o deinterlace.o
slouken@6886
    79
is how you might use
slouken@6886
    80
.B sdl2-config
slouken@6886
    81
to link compiled objects into a plugin for use by another program.
slouken@6886
    82
.SH AUTHOR
slouken@6886
    83
The Simple DirectMedia Layer (SDL) library was written by Sam Lantinga.
slouken@6886
    84
.PP
slouken@6886
    85
This manual page was written by Branden Robinson, originally for Progeny
slouken@6886
    86
Linux Systems, Inc., and the Debian Project.