English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 18 March 2020, 22:26   #1
sparhawk
Registered User

sparhawk's Avatar
 
Join Date: Sep 2019
Location: Essen/Germany
Age: 51
Posts: 321
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?
sparhawk is offline  
Old 25 March 2020, 11:46   #2
bebbo
botcher

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 457
Quote:
Originally Posted by sparhawk View Post
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
bebbo is offline  
Old 26 March 2020, 07:17   #3
sparhawk
Registered User

sparhawk's Avatar
 
Join Date: Sep 2019
Location: Essen/Germany
Age: 51
Posts: 321
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.
sparhawk is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
m68k-amigaos-gdb bebbo Coders. C/C++ 71 Yesterday 14:16
Calling convention for gcc (m68k-amigaos) sparhawk Coders. Language 3 11 January 2020 18:36
trying to make m68k-amigaos-gdb on windows jotd Coders. C/C++ 8 17 November 2019 14:17
m68k-amigaos-ld.exe bug ? FrenchShark Coders. General 2 30 November 2009 09:54
Shorten ported to AmigaOS m68k and WarpOS Paul News 0 20 August 2006 12:05

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:55.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.06780 seconds with 15 queries