diff --git a/StbiStreamWrapper.cs b/StbiStreamWrapper.cs index 6ac068e..37b6ad1 100644 --- a/StbiStreamWrapper.cs +++ b/StbiStreamWrapper.cs @@ -12,18 +12,23 @@ namespace ReFuel.Stb /// C array to read into. /// Size of the C array in bytes. /// The number of bytes read from the stream. + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public unsafe delegate int StbiReadProc(void *userdata, byte* buffer, int count); + /// /// Pointer to STBI stream skip function. /// /// User provided userdata pointer. /// Number of bytes to skip. + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public unsafe delegate void StbiSkipProc(void *userdata, int count); + /// /// Pointer to STBI stream end of file function. /// /// User provided userdata pointer. /// Non-zero value if the end of the stream has been reached. + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public unsafe delegate int StbiEofProc(void *userdata); /// @@ -123,4 +128,4 @@ namespace ReFuel.Stb public static implicit operator IntPtr(in StbiWriteStreamWrapper wrapper) => wrapper.Callback; } -} \ No newline at end of file +} diff --git a/StbiWrite.cs b/StbiWrite.cs index 94a3420..5432c17 100644 --- a/StbiWrite.cs +++ b/StbiWrite.cs @@ -9,6 +9,7 @@ namespace ReFuel.Stb.Native /// User provided context pointer. /// C Array of data to write. /// Size of the C array in bytes. + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public unsafe delegate void StbiWriteProc(void* context, void* data, int size); public unsafe partial class Stbi @@ -24,7 +25,7 @@ namespace ReFuel.Stb.Native } public static int write_png_compression_level - { + { get => *_png_compression_level_ptr; set => *_png_compression_level_ptr = value; }