[devel] Changed Windows calling convention back to __cdecl for API functions.

For Windows/x86 platforms only:
  __stdcall is no longer needed for Visual Basic, so libpng-1.5.0 uses
  __cdecl throughout (both API functions and callbacks) on Windows/x86
  platforms.
This commit is contained in:
Glenn Randers-Pehrson 2010-04-24 09:40:44 -05:00
parent c3d73f4da9
commit 9ee577c7f5
7 changed files with 117 additions and 107 deletions

View File

@ -178,6 +178,11 @@ version 1.5.0beta19 [April 24, 2010]
is to use the macros - this allows applications to choose at app build
time whether or not to use macros (previously impossible because the
functions weren't in the default build.)
Changed Windows calling convention back to __cdecl for API functions.
For Windows/x86 platforms only:
__stdcall is no longer needed for Visual Basic, so libpng-1.5.0 uses
__cdecl throughout (both API functions and callbacks) on Windows/x86
platforms.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit

View File

@ -2660,6 +2660,11 @@ version 1.5.0beta19 [April 24, 2010]
is to use the macros - this allows applications to choose at app build
time whether or not to use macros (previously impossible because the
functions weren't in the default build.)
Changed Windows calling convention back to __cdecl for API functions.
For Windows/x86 platforms only:
__stdcall is no longer needed for Visual Basic, so libpng-1.5.0 uses
__cdecl throughout (both API functions and callbacks) on Windows/x86
platforms.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

151
pngconf.h
View File

@ -90,9 +90,9 @@
* Microsoft and Borland C compilers ('IBM PC', 'DOS', 'Windows' systems
* and some others) there are multiple ways to call a function and the
* default can be changed on the compiler command line. For this reason
* libpng allows the calling convention of every exported function and
* every function called via a user supplied function pointer to be
* specified. This is done by defining the following macros:
* libpng specifies the calling convention of every exported function and
* every function called via a user supplied function pointer. This is
* done in this file by defining the following macros:
*
* PNGAPI Calling convention for exported functions.
* PNGCBAPI Calling convention for user provided (callback) functions.
@ -100,16 +100,19 @@
* for longjmp callbacks and sometimes used internally to
* specify the calling convention for zlib).
*
* These macros should never be overridden. If it is necessary to
* change calling convention in a private build this can be done
* by setting PNG_API_RULE (which defaults to 0) to one of the values
* below to select the correct 'API' variants.
*
* Two common cases are supported:
*
* PNG_API_RULE=0 Use the operating system convention for PNGAPI and
* PNG_API_RULE=0 Use PNGCAPI - the 'C' calling convention - throughout.
* This is correct in every known environment.
* PNG_API_RULE=1 Use the operating system convention for PNGAPI and
* the 'C' calling convention (from PNGCAPI) for
* callbacks (PNGCBAPI).
* PNG_API_RULE=1 Use PNGCAPI - the 'C' calling convention - throughout.
* This is correct on Cygwin implementations, assumed to
* be correct on MingW compilations and likely to work
* in C/C++ only environments everywhere else.
* callbacks (PNGCBAPI). This is no longer required
* in any known environment - if it has to be used
* please post an explanation of the problem to the
* libpng mailing list.
*
* These cases only differ if the operating system does not use the C
* calling convention, at present this just means the above cases
@ -160,82 +163,66 @@
* ==========================
* This code is used at build time to find PNG_IMPEXP, the API settings
* and PNG_EXPORT_TYPE(), it may also set a macro to indicate the DLL
* import processing is possible.
*
* NOTE: this is poorly tested and may miss many cases, the default
* (everything empty) is harmless unless the result is a DLL that is
* intended to be distributed!
* import processing is possible. On Windows/x86 systems it also sets
* compiler-specific macros to the values required to change the calling
* conventions of the various functions.
*/
#if defined(__CYGWIN__)
/* Cygwin: force PNGCAPI to cdecl. */
# ifndef PNGCAPI
# define PNGCAPI __cdecl
# endif
/* Provide the appropriate defaults for exporting a symbol from
* the DLL and forcing import. Always set these - the choice to
* use them is made below.
#if ( defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\
defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) ) &&\
( defined(_X86_) || defined(_X64_) || defined(_M_IX86) ||\
defined(_M_X64) || defined(_M_IA64) )
/* Windows system (DOS doesn't support DLLs) running on x86/x64.
* Includes builds under Cygwin or MinGW.
*/
# ifndef PNG_DLL_EXPORT
# define PNG_DLL_EXPORT __declspec(dllexport)
# endif
# ifndef PNG_DLL_IMPORT
# define PNG_DLL_IMPORT __declspec(dllimport)
# endif
#else /* !Cygwin */
# if ( defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\
defined(_WIN32) || defined(__WIN32__) ) &&\
( defined(_X86_) || defined(_X64_) || defined(_M_IX86) ||\
defined(_M_X64) || defined(_M_IA64) )
/* Windows system (DOS doesn't support DLLs) running on x86/x64 and
* not being built under Cygwin or by a MingW compiler.
# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
# define PNGCAPI __cdecl
# if PNG_API_RULE == 1
# define PNGAPI __stdcall
# endif
# else
/* An older compiler, or one not detected (erroneously) above,
* if necessary override on the command line to get the correct
* variants for the compiler.
*/
# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
# ifndef PNGCAPI
# define PNGCAPI __cdecl
# endif
# if PNG_API_RULE == 0 && !defined(PNGAPI)
# define PNGAPI __stdcall
# endif
# else
/* An older compiler, or one not detected (erroneously) above. */
# ifndef PNGCAPI
# define PNGCAPI _cdecl
# endif
# if PNG_API_RULE == 0 && !defined(PNGAPI)
# define PNGAPI _stdcall
# endif
# endif /* compiler/api */
/* NOTE: PNGCBAPI always defaults to PNGCAPI. */
# ifndef PNGCAPI
# define PNGCAPI _cdecl
# endif
# if PNG_API_RULE == 1 && !defined(PNGAPI)
# define PNGAPI _stdcall
# endif
# endif /* compiler/api */
/* NOTE: PNGCBAPI always defaults to PNGCAPI. */
# if (defined(_MSC_VER) && _MSC_VER < 800) ||\
(defined(__BORLANDC__) && __BORLANDC__ < 0x500)
/* older Borland and MSC
* compilers used '__export' and required this to be after
* the type.
*/
# ifndef PNG_EXPORT_TYPE
# define PNG_EXPORT_TYPE(type) type PNG_IMPEXP
# endif
# define PNG_DLL_EXPORT __export
# else /* newer compiler */
# define PNG_DLL_EXPORT __declspec(dllexport)
# ifndef PNG_DLL_IMPORT
# define PNG_DLL_IMPORT __declspec(dllimport)
# endif
# endif /* compiler */
# if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
ERROR: PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed
# endif
# else /* !Cygwin && !Windows/x86 */
# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
# ifndef PNGAPI
# define PNGAPI _System
# endif
# else /* !Cygwin && !Windows/x86 && !OS/2 */
/* Use the defaults */
# endif /* other system, !OS/2 */
# endif /* !Windows/x86 */
#endif /* !Cygwin */
# if (defined(_MSC_VER) && _MSC_VER < 800) ||\
(defined(__BORLANDC__) && __BORLANDC__ < 0x500)
/* older Borland and MSC
* compilers used '__export' and required this to be after
* the type.
*/
# ifndef PNG_EXPORT_TYPE
# define PNG_EXPORT_TYPE(type) type PNG_IMPEXP
# endif
# define PNG_DLL_EXPORT __export
# else /* newer compiler */
# define PNG_DLL_EXPORT __declspec(dllexport)
# ifndef PNG_DLL_IMPORT
# define PNG_DLL_IMPORT __declspec(dllimport)
# endif
# endif /* compiler */
#else /* !Windows/x86 */
# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
# define PNGAPI _System
# else /* !Windows/x86 && !OS/2 */
/* Use the defaults, or define PNG*API on the command line (but
* this will have to be done for every compile!)
*/
# endif /* other system, !OS/2 */
#endif /* !Windows/x86 */
/* Now do all the defaulting . */
#ifndef PNGCAPI

View File

@ -1,6 +1,7 @@
/* 1.5.0beta19 STANDARD API DEFINITION */
/* pnglibconf.h - library build configuration */
/* libpng version 1.5.0beta17 - April 2, 2010 */
/* libpng version 1.5.0beta19 - April 2, 2010 */
/* Copyright (c) 1998-2010 Glenn Randers-Pehrson */
@ -8,17 +9,12 @@
/* For conditions of distribution and use, see the disclaimer */
/* and license in png.h */
/* This file generates a libpng library with no STDIO support,
* it is provided to allow generation of a DLL suitable for use
* with Visual Basic and for no other purpose.
*/
/* pnglibconf.h */
/* Machine generated file: DO NOT EDIT */
/* Derived from: scripts/pnglibconf.dfa with PNG_NO_STDIO */
/* Derived from: scripts/pnglibconf.dfa */
#ifndef PNGLCONF_H
#define PNGLCONF_H
/* settings */
#define PNG_USER_PRIVATEBUILD "libpng DLL for use with Visual Basic"
#define PNG_USER_DLLFNAME_POSTFIX "VB"
#define PNG_CALLOC_SUPPORTED
#define PNG_USER_WIDTH_MAX 1000000L
#define PNG_API_RULE 0
@ -36,17 +32,23 @@
#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_USER_LIMITS_SUPPORTED
#define PNG_FIXED_POINT_SUPPORTED
/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
#define PNG_ERROR_TEXT_SUPPORTED
#define PNG_READ_SUPPORTED
/*#undef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED*/
/*#undef PNG_BENIGN_ERRORS_SUPPORTED*/
#define PNG_SETJMP_SUPPORTED
#define PNG_WRITE_FLUSH_SUPPORTED
#define PNG_MNG_FEATURES_SUPPORTED
#define PNG_FLOATING_POINT_SUPPORTED
/*#undef PNG_INCH_CONVERSIONS_SUPPORTED*/
#define PNG_STDIO_SUPPORTED
#define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_USER_MEM_SUPPORTED
#define PNG_IO_STATE_SUPPORTED
#define PNG_SET_USER_LIMITS_SUPPORTED
#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED
#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
#define PNG_WRITE_FILTER_SUPPORTED
#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
@ -83,6 +85,7 @@
#define PNG_READ_SHIFT_SUPPORTED
#define PNG_CONVERT_tIME_SUPPORTED
#define PNG_READ_USER_TRANSFORM_SUPPORTED
#define PNG_READ_INT_FUNCTIONS_SUPPORTED
#define PNG_READ_USER_CHUNKS_SUPPORTED
#define PNG_READ_hIST_SUPPORTED
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
@ -90,6 +93,7 @@
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
#define PNG_SEQUENTIAL_READ_SUPPORTED
#define PNG_READ_BACKGROUND_SUPPORTED
#define PNG_READ_QUANTIZE_SUPPORTED
#define PNG_READ_iCCP_SUPPORTED
#define PNG_READ_STRIP_ALPHA_SUPPORTED
#define PNG_READ_PACKSWAP_SUPPORTED
@ -103,9 +107,11 @@
#define PNG_READ_tIME_SUPPORTED
#define PNG_READ_pHYs_SUPPORTED
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
#define PNG_TIME_RFC1123_SUPPORTED
#define PNG_READ_TEXT_SUPPORTED
#define PNG_WRITE_BGR_SUPPORTED
#define PNG_USER_CHUNKS_SUPPORTED
#define PNG_CONSOLE_IO_SUPPORTED
#define PNG_GET_INT_32_SUPPORTED
#define PNG_WRITE_PACK_SUPPORTED
#define PNG_READ_FILLER_SUPPORTED

View File

@ -6,10 +6,6 @@ This code is released under the libpng license.
For conditions of distribution and use, see copyright notice in png.h
Changes in libpng 15:
* The standard calling convention (used in all builds) is __stdcall for
libpng exported functions and __cdecl for function callbacks.
Consequently the VB configuration is no longer required but is provided
in libpng15vb.dll for backward compatibility.
* The DEF file is no longer required, the DLLs link by name. A standard
DEF file, pngwin.def, is included in the distribution for applications
that require link by number (ordinal), builds that require link by
@ -18,9 +14,14 @@ Changes in libpng 15:
Assumptions:
* The libpng source files are in ..\..
* The zlib source files are in ..\..\..\zlib
* The zlib project file is in . /* Warning: This is until the zlib project
files get intergrated into the next zlib release. The final zlib project
directory will then be ..\..\..\zlib\projects\visualc71. */
The source files must be from zlib version 1.2.3 - this project file
will not work with any other version.
* The zlib project file is in .
You may delete the zlib project from the solution and use the official
zlib build instead - take care to link against either zlib.lib or zdll.lib
as appropriate. You must do this if you want to use a version of zlib other
than zlib-1.2.3!
To use:
@ -46,7 +47,7 @@ This project builds the libpng binaries as follows:
* Win32_DLL_Release\libpng15.dll DLL build
* Win32_DLL_Debug\libpng15d.dll DLL build (debug version)
* Win32_DLL_VB\libpng15vb.dll DLL build for Visual Basic, using stdcall
* Win32_DLL_VB\libpng15vb.dll DLL build for Visual Basic (no stdio)
* Win32_LIB_Release\libpng.lib static build
* Win32_LIB_Debug\libpngd.lib static build (debug version)

View File

@ -1,6 +1,7 @@
/* 1.5.0beta19 STANDARD API DEFINITION */
/* pnglibconf.h - library build configuration */
/* libpng version 1.5.0beta17 - April 2, 2010 */
/* libpng version 1.5.0beta19 - April 2, 2010 */
/* Copyright (c) 1998-2010 Glenn Randers-Pehrson */
@ -8,17 +9,12 @@
/* For conditions of distribution and use, see the disclaimer */
/* and license in png.h */
/* This file generates a libpng library with no STDIO support,
* it is provided to allow generation of a DLL suitable for use
* with Visual Basic and for no other purpose.
*/
/* pnglibconf.h */
/* Machine generated file: DO NOT EDIT */
/* Derived from: scripts/pnglibconf.dfa with PNG_NO_STDIO */
/* Derived from: scripts/pnglibconf.dfa */
#ifndef PNGLCONF_H
#define PNGLCONF_H
/* settings */
#define PNG_USER_PRIVATEBUILD "libpng DLL for use with Visual Basic"
#define PNG_USER_DLLFNAME_POSTFIX "VB"
#define PNG_CALLOC_SUPPORTED
#define PNG_USER_WIDTH_MAX 1000000L
#define PNG_API_RULE 0
@ -36,17 +32,23 @@
#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_USER_LIMITS_SUPPORTED
#define PNG_FIXED_POINT_SUPPORTED
/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
#define PNG_ERROR_TEXT_SUPPORTED
#define PNG_READ_SUPPORTED
/*#undef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED*/
/*#undef PNG_BENIGN_ERRORS_SUPPORTED*/
#define PNG_SETJMP_SUPPORTED
#define PNG_WRITE_FLUSH_SUPPORTED
#define PNG_MNG_FEATURES_SUPPORTED
#define PNG_FLOATING_POINT_SUPPORTED
/*#undef PNG_INCH_CONVERSIONS_SUPPORTED*/
#define PNG_STDIO_SUPPORTED
#define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_USER_MEM_SUPPORTED
#define PNG_IO_STATE_SUPPORTED
#define PNG_SET_USER_LIMITS_SUPPORTED
#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED
#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
#define PNG_WRITE_FILTER_SUPPORTED
#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
@ -83,6 +85,7 @@
#define PNG_READ_SHIFT_SUPPORTED
#define PNG_CONVERT_tIME_SUPPORTED
#define PNG_READ_USER_TRANSFORM_SUPPORTED
#define PNG_READ_INT_FUNCTIONS_SUPPORTED
#define PNG_READ_USER_CHUNKS_SUPPORTED
#define PNG_READ_hIST_SUPPORTED
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
@ -90,6 +93,7 @@
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
#define PNG_SEQUENTIAL_READ_SUPPORTED
#define PNG_READ_BACKGROUND_SUPPORTED
#define PNG_READ_QUANTIZE_SUPPORTED
#define PNG_READ_iCCP_SUPPORTED
#define PNG_READ_STRIP_ALPHA_SUPPORTED
#define PNG_READ_PACKSWAP_SUPPORTED
@ -103,9 +107,11 @@
#define PNG_READ_tIME_SUPPORTED
#define PNG_READ_pHYs_SUPPORTED
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
#define PNG_TIME_RFC1123_SUPPORTED
#define PNG_READ_TEXT_SUPPORTED
#define PNG_WRITE_BGR_SUPPORTED
#define PNG_USER_CHUNKS_SUPPORTED
#define PNG_CONSOLE_IO_SUPPORTED
#define PNG_GET_INT_32_SUPPORTED
#define PNG_WRITE_PACK_SUPPORTED
#define PNG_READ_FILLER_SUPPORTED

View File

@ -1,5 +1,5 @@
Makefiles for libpng version 1.5.0beta19 - April 18, 2010
Makefiles for libpng version 1.5.0beta19 - April 24, 2010
pnglibconf.h => Stores configuration settings
makefile.linux => Linux/ELF makefile