Hello everybody,
I have a problem with libpng library, I am trying to use my own memory allocation routines. So, as stays in doc, I define PNG_USER_MEM_SUPPORTED and want to use png_create_read_struct_2() instead of png_create_read_struct(). png_create_read_struct_2 takes following parameters:

png_structp png_ptr = png_create_read_struct_2
       (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
        user_error_fn, user_warning_fn, (png_voidp)
        user_mem_ptr, user_malloc_fn, user_free_fn);

I'm interested in last three params.
I've wrote my_malloc and my_free, but my question is, what is the user_mem_ptr, and if anyone worked with it and used it, please give me a clue, or link me to some example (I haven't found a well explained example on web :-| ).
Thank you in advance.

12 Years
Discussion Span
Last Post by Index

Hi all,
I passed null as user_mem_ptr, and it seems to work. But I still wonder what is it for. Anyway, if I find out, i'll let you know. Greets


this is manual (old version) I was quoting from, but there is no explanation of using user_mem_ptr param, well, thanks anyway for your time :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.