From d9a9e3962f8fd3c6462230101a7316fdf30b96c9 Mon Sep 17 00:00:00 2001 From: "H. Utku Maden" Date: Wed, 19 Jun 2024 11:47:54 +0300 Subject: [PATCH] Fix build error on older c# versions. --- StbiStreamWrapper.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/StbiStreamWrapper.cs b/StbiStreamWrapper.cs index c1900ca..6ac068e 100644 --- a/StbiStreamWrapper.cs +++ b/StbiStreamWrapper.cs @@ -98,13 +98,13 @@ namespace ReFuel.Stb /// /// An easy to use stream wrapper for STBI image write functions. /// - /// Keep struct alive for the duration of the write operation. - public struct StbiWriteStreamWrapper + /// Keep object alive for the duration of the write operation. + public class StbiWriteStreamWrapper { private readonly Stream _stream; private readonly StbiWriteProc _cb; - public IntPtr Callback => Marshal.GetFunctionPointerForDelegate(_cb); + public IntPtr Callback { get; } public StbiWriteStreamWrapper(Stream stream) { @@ -113,6 +113,7 @@ namespace ReFuel.Stb { _cb = WriteCb; } + Callback = Marshal.GetFunctionPointerForDelegate(_cb); } private unsafe void WriteCb(void *context, void *data, int size)