SGDK and C++?

SGDK only sub forum

Moderator: Stef

Post Reply
Xynxyn
Very interested
Posts: 54
Joined: Fri Jun 15, 2012 10:32 am
Location: Poland

SGDK and C++?

Post by Xynxyn » Sun Jul 07, 2013 8:34 pm

Will SGDK ever meet C++? :)

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sun Jul 07, 2013 10:02 pm

SGDK does not support C++ as it requires more binaries and libraries to get it work (actually a lot more). I always wanted to maintain SGDK size to the strict minimum requirement, also C++ add some overhead which might hurt for megadrive development...
Still i agree it would be nice to have C++ (and so OO programming) support, that may be something to thing about... I believe Chilly Willy already got C++ support on with 68k targeted gcc and he reported overhead was not that heavy. Problem is that i really want to stay on gcc 3.4.6 for SGDK as newers version are really awful in term of code generation for 68k target.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Mon Jul 08, 2013 2:33 am

My toolchain does support C++ and comes with a C++ example. You can't use SGDK with it, but you could use pieces from it where needed.

The ridiculous overhead is if you include the iostream... the example is a few hundred KB with it, and less than 64KB without it. The facility that strips unused library code doesn't work on MD binaries due to the binary blob at the start.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Mon Jul 08, 2013 8:18 am

By binary blob you mean the inclusion of the header binary right ?
I do not see how to handle it so we can easily modify it without modifying the sega.s file directly.

sega16
Very interested
Posts: 251
Joined: Sat Jan 29, 2011 3:16 pm
Location: U.S.A.

Post by sega16 » Mon Jul 08, 2013 9:57 pm

Do you mean binary blob like the Linux,the kernel includes if so a binary blob has the bad side-effect of making all programs that use it non-free software. I would assume that non-free binary blob can easily be replaced with a free-software replacement. I don't see the need for a binary blob.

Mask of Destiny
Very interested
Posts: 616
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Mon Jul 08, 2013 10:18 pm

sega16 wrote:Do you mean binary blob like the Linux,the kernel includes if so a binary blob has the bad side-effect of making all programs that use it non-free software. I would assume that non-free binary blob can easily be replaced with a free-software replacement. I don't see the need for a binary blob.
I assume Chilly is referring to the cartridge ROM header which is just a 68K exception vector table and the Sega header which contains the 'SEGA' string that's checked by the TMSS and some useful information which in the modern context is probably mostly useful for emulators. At the very least, the vector table is strictly required and at least the 'SEGA' string is required for TMSS systems.

I wonder if the dead code elimination issue could be fixed by producing a proper ELF binary and then producing a final binary with objcopy and perhaps an extra script or two.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Tue Jul 09, 2013 2:46 am

The compiler is used to stripping a regular ELF file with a standard entry vector. I may try to find a way to strip the file before adding the rom header and making the final binary. At the moment, it's not very critical - just avoid iostream, which isn't useful on a console anyway.

Post Reply