Cannot convert argument from Dynamic to void*

I am attempting to create an image using linc’s stb and sdl library together to load an image from memory, instead of directly from a file, using the following code:

public function loadImage(renderer:Renderer, file:String)
    {
        var bytes = sys.io.File.getBytes(file);
        var img = Image.load_from_memory(bytes.getData(), bytes.length);
        if (img == null)
        {
            trace("Error loading image: " + Image.failure_reason());
            return;
        }
        else
        {
            width = img.w;
            height = img.h;
            
            var io:RWops = SDL.RWFromMem(img.bytes, img.bytes.length);
            var image:Surface = SDL.loadBMP_RW(io, 1);
            
            if (image == null)
            {
                trace(SDL.getError());
                return;
            }
            
            texture = SDL.createTextureFromSurface(renderer, image);
        }
        
    }

However, when compiling, on the line where it goes:

var io:RWops = SDL.RWFromMem(img.bytes, img.bytes.length);

I get an error stating that SDL_RWops *SDL_RWFromMem(void *, int) : cannot convert argument 1 from Dynamic to void *. Strangely, img.bytes is actually defined in this file as BytesData which is what RWFromMem function is asking for.

Any suggestions? Any experts on SDL that can help? :wink:

Maybe the generated C++ just needs a (void*) cast in there, or perhaps you need a pointer to where the data starts, rather than the actual Haxe object reference

Sorry, I should have mentioned that it was actually a bug found in the Linc SDL project, which I did not consider at the time. I just thought it was my incompetence :wink: