English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. C/C++ (http://eab.abime.net/forumdisplay.php?f=118)
-   -   setjump with m68k-amigaos gives an error (http://eab.abime.net/showthread.php?t=101330)

sparhawk 18 March 2020 22:26

setjump with m68k-amigaos gives an error
 
I tried to compile the libpng library, which worked so far. However, when I try to build a sample code using it, I get some error when I try to use the setjump function which should be used for error handling:


The example I used is here: http://zarb.org/~gc/html/libpng.html

Code:

    if (setjmp(png_jmpbuf(png_ptr)))
        return PNGShutdown(false, fp, "Error during init io");



Code:

main.cpp:60:72: error: invalid conversion from 'void (__attribute__((__stkparm__)) *)(int*, int)' to 'png_longjmp_ptr {aka void (*)(int*, int)}' [-fpermissive]
  if (setjmp(png_jmpbuf(png_ptr)))


Any idea how to fix it? I recompiled libPNG with setjump disabled, but then I get some other error, because you have to provide your own function instead and I haven't figured out yet, what it expects. Maybe this would be the way to go? Or is there some easier way to fix the above error?

bebbo 25 March 2020 11:46

Quote:

Originally Posted by sparhawk (Post 1386032)
I tried to compile the libpng library, which worked so far. However, when I try to build a sample code using it, I get some error when I try to use the setjump function which should be used for error handling:


The example I used is here: http://zarb.org/~gc/html/libpng.html


uhm... this code compiles and seems to run



Code:

m68k-amigaos-gcc test.c -noixemul -m68020 -Os -o b -lpng -lm -lz


 vamos -C20 test
Usage: program_name <file_in> <file_out>
Program aborted


sparhawk 26 March 2020 07:17

I also fixed this already with a workaround by putting a helper in a ".c" file. When I compile this from g++ then I get this error, apparently again a __stdarg problem.


All times are GMT +2. The time now is 07:49.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.

Page generated in 0.03986 seconds with 11 queries