[Top][All Lists]

[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/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]