[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[fluid-dev] About Supporting 2GiB+ Soundfonts on Windows
From: |
Tom M. |
Subject: |
[fluid-dev] About Supporting 2GiB+ Soundfonts on Windows |
Date: |
Mon, 16 Mar 2020 14:57:56 +0100 |
We have a bug report on GitHub [1]: A user reports that loading Soundfonts
>2GiB fails on Win10 64bit. There are two factors making up the root cause:
1. The ANSI C file API, namely ftell() and fseek(), use "long" as data type
for specifying offsets in the file.
2. Even on 64bit Windows, "long" is only a 32bit integer.
As a consequence, files >2GiB cannot be accessed through the standard C
library on Windows.
Of course, there are non-standard extensions: POSIX has ftello64() and
fseeko64(), Windows has _ftelli64() and _fseeki64().
BUT: we cannot simply switch to use those extension functions, because the
file operations are exposed via the our public API [2].
That is, switching to the 64bit extension functions would require to adopt our
API to use a 64bit integer, rather than "long". And THIS IS THE PROBLEM: There
is not signed 64bit integer in C89!
To fix this issue correctly, I currently see no other possibility than moving
fluidsynth to C99 and use "long long" in our public headers. Downsides:
* Moving to C99 would require VS2015.
* And people, who are consuming our header in a C++ project were required to
use C++11 in order to support the type "long long".
We cannot simply use size_t, because fseek requires a signed integer in order
to seek backwards in the file.
The current workaround is to build fluidsynth with CygWin, which has "long"
set to 64bit.
Any ideas how to solve this? Opinions on C99?
[1] https://github.com/FluidSynth/fluidsynth/issues/628
[2] http://www.fluidsynth.org/api/
sfont_8h.html#ac5cf57119fee0cde7422c86beafe0917
Tom
- [fluid-dev] About Supporting 2GiB+ Soundfonts on Windows,
Tom M. <=
- Re: [fluid-dev] About Supporting 2GiB+ Soundfonts on Windows, Dan Eble, 2020/03/16
- Re: [fluid-dev] About Supporting 2GiB+ Soundfonts on Windows, Reinhold Hoffmann, 2020/03/17
- Re: [fluid-dev] About Supporting 2GiB+ Soundfonts on Windows, Tom M., 2020/03/17
- Re: [fluid-dev] About Supporting 2GiB+ Soundfonts on Windows, Carlo Bramini, 2020/03/17
- Re: [fluid-dev] About Supporting 2GiB+ Soundfonts on Windows, Tom M., 2020/03/17
- Re: [fluid-dev] About Supporting 2GiB+ Soundfonts on Windows, Carlo Bramini, 2020/03/19
- Re: [fluid-dev] About Supporting 2GiB+ Soundfonts on Windows, Tom M., 2020/03/21
- Re: [fluid-dev] About Supporting 2GiB+ Soundfonts on Windows, Ceresa Jean-Jacques, 2020/03/17
- Re: [fluid-dev] About Supporting 2GiB+ Soundfonts on Windows, Dan Eble, 2020/03/17