New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot load large (2GiB+) SF2 file on Windows #628
Comments
|
Damn. Technically, your suggestions are correct. However, we are exposing those file callbacks via our API and changing The more difficult question that arises, is how to deal with |
Why not use |
|
Another (very hacky) possibility is to define a custom type depending on the platform, like this: #ifdef WIN64
typedef int64_t fluid_long;
#else
typedef long fluid_long;
#endifThis would not break ABI on Linux but would fix the Windows behaviour. |
Not really. Microsoft just added fully compliant support for C99 in VS2015. And we have a few commercial users who still use VS2010. The day we will switch to C99 will come, but surely not for the next 2.1.2 bugfix release. In the meantime, we are stuck with C89. |
|
As far as I remember, 64-bit integers and functions like |
|
You are missing the fact that those file-operations are exposed via our public API. Here, we need a standard compliant signed 64 bit int that we can expose in our API (*). And for that we need to make fluidsynth switching to C99. If this was only a question of an implementation detail, i.e. which function(s) to use under the hood, it would be trivial. Still, you are welcome to propose a PR. Perhaps this will help to better understand the scope of this change. However, I would vote for using (*): Ofc one might think about simply implementing our own 64int type: struct fluid_int64{
int hi;
int lo;}But how to make sure that |
|
Yes, I agree that this breaks not only API but ABI, so the fixing can be probably done in no earlier than 3.0. So, probably the only remaining workaround is to build FluidSynth on Cygwin (I've tested it, and it seems to work), which defines the |
|
We've discussed this issue on the mailing list: https://lists.nongnu.org/archive/html/fluid-dev/2020-03/msg00009.html We came up with a solution, which I'll be implementing in the next days. This will be included in the 2.2.0 release. But there is no release date for it yet. In the meantime, the Cygwin workaround must be sufficient. Thanks for the hint! |
FluidSynth version
2.0.4 (but it probably affects later version, according to the code in the
masterbranch)Describe the bug
On Windows, attempting to load a SF2 file larger than 2GiB (32-bit signed integer limit) fails with the following error:
Expected behavior
The SF2 file should load as usual (is there is enough RAM to do this).
Steps to reproduce
Start FluidSynth on Windows with a SF2 file of 2GiB+.
Additional context
The problem is caused by calling
ftell()function (see here), which is hardcoded to returnlong. On x86_64 Linux, there is no problem here becauselongis usually defined as 64 bits on this architecture, but Windows is not the case, andlongis 32 bits even on 64-bit Windows.Suggestions:
longreturn values withsize_t, since it will give more reliable bit width.ftell()(as well as other related functions likefseek()) is defined in the standard to returnlong, so on Windows the regularftell()won't work. It'll be necessary to use Windows-specific things like_ftelli64()(wrapping them into#ifdef WIN32etc.)If some consensus on this is reached, I will try to make a PR fixing that.
The text was updated successfully, but these errors were encountered: