Fix build error on older c# versions.
Some checks failed
Build / build (push) Failing after 1m28s

This commit is contained in:
H. Utku Maden 2024-06-19 11:47:54 +03:00
parent f976af3833
commit 925464e0c0

@ -98,13 +98,13 @@ namespace ReFuel.Stb
/// <summary> /// <summary>
/// An easy to use stream wrapper for STBI image write functions. /// An easy to use stream wrapper for STBI image write functions.
/// </summary> /// </summary>
/// <remarks>Keep struct alive for the duration of the write operation.</remarks> /// <remarks>Keep object alive for the duration of the write operation.</remarks>
public struct StbiWriteStreamWrapper public class StbiWriteStreamWrapper
{ {
private readonly Stream _stream; private readonly Stream _stream;
private readonly StbiWriteProc _cb; private readonly StbiWriteProc _cb;
public IntPtr Callback => Marshal.GetFunctionPointerForDelegate(_cb); public IntPtr Callback { get; };
public StbiWriteStreamWrapper(Stream stream) public StbiWriteStreamWrapper(Stream stream)
{ {
@ -113,6 +113,7 @@ namespace ReFuel.Stb
{ {
_cb = WriteCb; _cb = WriteCb;
} }
Callback = Marshal.GetFunctionPointerForDelegate(_cb);
} }
private unsafe void WriteCb(void *context, void *data, int size) private unsafe void WriteCb(void *context, void *data, int size)