Because this was already defined in the xunxun's gcc 4.6.3 package(MinGW64).
What about other (especially older) compilers?
Both tests: I use libz from mingw official sites
zlib.
Test ONE:
I test the tdm gcc 4.6.1 sjlj, the compile stage passed, so it looks like those declaration does not need at least in tdm-gcc 4.6.1. As I know, tdm gcc use official Mingw API. while xunxun's gcc 4.6.3 use mingw64 API.
but the link stage failed:
-------------- Clean: exchndl in Code::Blocks wx2.8.x ---------------
Cleaned "Code::Blocks wx2.8.x - exchndl"
-------------- Build: exchndl in Code::Blocks wx2.8.x ---------------
[ 50.0%] gcc.exe -Wall -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -iquote.objs\include -I.objs\include -I. -IE:\code\cb\wx\wxWidgets-2.8.12\include -IE:\code\cb\wx\wxWidgets-2.8.12\contrib\include -IE:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll\mswu -Isdk\wxscintilla\include -Isdk\wxpropgrid\include -Iinclude\tinyxml -Ibase\exchndl\include -c E:\code\cb\cb_trunk\src\base\exchndl\exchndl.c -o .objs\base\exchndl\exchndl.o
[100.0%] g++.exe -shared -Wl,--dll -Lbase\tinyxml -LE:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll -Lbase\exchndl\lib .objs\base\exchndl\exchndl.o -o devel\exchndl.dll -lwxmsw28u -lbfd -liberty -lz
e:/code/gcc/tdmgcc461sjlj/bin/../lib/gcc/mingw32/4.6.1/../../../libbfd.a(bfd.o): In function `snprintf':
e:/code/gcc/pcxmingw4630209/mingw/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/include/stdio.h:559: undefined reference to `__ms_vsnprintf'
e:/code/gcc/tdmgcc461sjlj/bin/../lib/gcc/mingw32/4.6.1/../../../libbfd.a(pe-i386.o): In function `snprintf':
e:/code/gcc/pcxmingw4630209/mingw/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/include/stdio.h:559: undefined reference to `__ms_vsnprintf'
e:/code/gcc/tdmgcc461sjlj/bin/../lib/gcc/mingw32/4.6.1/../../../libbfd.a(pei-i386.o): In function `snprintf':
e:/code/gcc/pcxmingw4630209/mingw/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/include/stdio.h:559: undefined reference to `__ms_vsnprintf'
e:/code/gcc/tdmgcc461sjlj/bin/../lib/gcc/mingw32/4.6.1/../../../libbfd.a(archive.o): In function `snprintf':
e:/code/gcc/pcxmingw4630209/mingw/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/include/stdio.h:559: undefined reference to `__ms_vsnprintf'
e:/code/gcc/tdmgcc461sjlj/bin/../lib/gcc/mingw32/4.6.1/../../../libbfd.a(elf.o): In function `snprintf':
e:/code/gcc/pcxmingw4630209/mingw/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/include/stdio.h:559: undefined reference to `__ms_vsnprintf'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
5 errors, 0 warnings (0 minutes, 1 seconds)
Here, my libiberty and libbfd is copied from gdb installation which is build from xunxun's 4.6.3. so it have some undefined reference in the link stage
As a conclusion, I guess it should be OK if the libbfd is build from tdm-gcc.
Test Two:
I test under loaden's gcc 4.4.5 release under 2010.10.12 (MinGW ALL 4.4.5 (binutils-2.20.1-2,make-3.82,mingwrt-3.18,w32api-3.15,pthreads2.8,iconv_1.13.1)), still failed in the link stage:
------------- Clean: exchndl in Code::Blocks wx2.8.x ---------------
Cleaned "Code::Blocks wx2.8.x - exchndl"
-------------- Build: exchndl in Code::Blocks wx2.8.x ---------------
[ 50.0%] gcc.exe -Wall -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -iquote.objs\include -I.objs\include -I. -IE:\code\cb\wx\wxWidgets-2.8.12\include -IE:\code\cb\wx\wxWidgets-2.8.12\contrib\include -IE:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll\mswu -Isdk\wxscintilla\include -Isdk\wxpropgrid\include -Iinclude\tinyxml -Ibase\exchndl\include -c E:\code\cb\cb_trunk\src\base\exchndl\exchndl.c -o .objs\base\exchndl\exchndl.o
[100.0%] g++.exe -shared -Wl,--dll -Lbase\tinyxml -LE:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll -Lbase\exchndl\lib .objs\base\exchndl\exchndl.o -o devel\exchndl.dll -lwxmsw28u -lbfd -liberty -lz
E:\code\cb\gcc\mingw-static-4.4.5-all\bin/ld.exe: Dwarf Error: Offset (18560) greater than or equal to .debug_abbrev size (1202).
e:/code/cb/gcc/mingw-static-4.4.5-all/bin/../lib/gcc/i686-mingw32/4.4.5/../../../libbfd.a(bfd.o):bfd.c:(.text+0x23): undefined reference to `__ms_vsnprintf'
E:\code\cb\gcc\mingw-static-4.4.5-all\bin/ld.exe: Dwarf Error: Offset (59072) greater than or equal to .debug_abbrev size (1388).
e:/code/cb/gcc/mingw-static-4.4.5-all/bin/../lib/gcc/i686-mingw32/4.4.5/../../../libbfd.a(pe-i386.o):pe-i386.c:(.text+0x10f3): undefined reference to `__ms_vsnprintf'
E:\code\cb\gcc\mingw-static-4.4.5-all\bin/ld.exe: Dwarf Error: Offset (164188) greater than or equal to .debug_abbrev size (1420).
e:/code/cb/gcc/mingw-static-4.4.5-all/bin/../lib/gcc/i686-mingw32/4.4.5/../../../libbfd.a(pei-i386.o):pei-i386.c:(.text+0x13c3): undefined reference to `__ms_vsnprintf'
E:\code\cb\gcc\mingw-static-4.4.5-all\bin/ld.exe: Dwarf Error: Offset (30800) greater than or equal to .debug_abbrev size (1265).
e:/code/cb/gcc/mingw-static-4.4.5-all/bin/../lib/gcc/i686-mingw32/4.4.5/../../../libbfd.a(archive.o):archive.c:(.text+0x313): undefined reference to `__ms_vsnprintf'
E:\code\cb\gcc\mingw-static-4.4.5-all\bin/ld.exe: Dwarf Error: found dwarf version '0', this reader only handles version 2 and 3 information.
e:/code/cb/gcc/mingw-static-4.4.5-all/bin/../lib/gcc/i686-mingw32/4.4.5/../../../libbfd.a(archive.o):archive.c:(.text+0x2bba): undefined reference to `__chkstk_ms'
E:\code\cb\gcc\mingw-static-4.4.5-all\bin/ld.exe: Dwarf Error: Offset (242624) greater than or equal to .debug_abbrev size (1608).
e:/code/cb/gcc/mingw-static-4.4.5-all/bin/../lib/gcc/i686-mingw32/4.4.5/../../../libbfd.a(elf.o):elf.c:(.text+0x3e3): undefined reference to `__ms_vsnprintf'
E:\code\cb\gcc\mingw-static-4.4.5-all\bin/ld.exe: Dwarf Error: Offset (328996) greater than or equal to .debug_abbrev size (1596).
e:/code/cb/gcc/mingw-static-4.4.5-all/bin/../lib/gcc/i686-mingw32/4.4.5/../../../libbfd.a(elflink.o):elflink.c:(.text+0x1e77): undefined reference to `__chkstk_ms'
E:\code\cb\gcc\mingw-static-4.4.5-all\bin/ld.exe: Dwarf Error: Offset (68096) greater than or equal to .debug_abbrev size (1028).
e:/code/cb/gcc/mingw-static-4.4.5-all/bin/../lib/gcc/i686-mingw32/4.4.5/../../../libiberty.a(cp-demangle.o):cp-demangle.c:(.text+0x6fab): undefined reference to `__chkstk_ms'
E:\code\cb\gcc\mingw-static-4.4.5-all\bin/ld.exe: Dwarf Error: found dwarf version '1', this reader only handles version 2 and 3 information.
e:/code/cb/gcc/mingw-static-4.4.5-all/bin/../lib/gcc/i686-mingw32/4.4.5/../../../libiberty.a(cp-demangle.o):cp-demangle.c:(.text+0x6fc3): undefined reference to `__chkstk_ms'
E:\code\cb\gcc\mingw-static-4.4.5-all\bin/ld.exe: Dwarf Error: found dwarf version '20039', this reader only handles version 2 and 3 information.
e:/code/cb/gcc/mingw-static-4.4.5-all/bin/../lib/gcc/i686-mingw32/4.4.5/../../../libiberty.a(cp-demangle.o):cp-demangle.c:(.text+0x75a3): undefined reference to `__chkstk_ms'
E:\code\cb\gcc\mingw-static-4.4.5-all\bin/ld.exe: Dwarf Error: found dwarf version '8259', this reader only handles version 2 and 3 information.
e:/code/cb/gcc/mingw-static-4.4.5-all/bin/../lib/gcc/i686-mingw32/4.4.5/../../../libiberty.a(cp-demangle.o):cp-demangle.c:(.text+0x75bb): undefined reference to `__chkstk_ms'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
11 errors, 0 warnings (0 minutes, 1 seconds)
So, the reason is the same as tdm-gcc. The libbfd and libiberty should have the same gcc version used to build exchndl.dll.
The change in internal.h should be OK from my point.
Can some one test it?