Future of the libraries

Other misc things
cborn
Well known member
Posts: 267
Joined: Tue Oct 06, 2020 7:45 pm

Re: Future of the libraries

Post by cborn »

Hi, i am still a big nono and from most off the libs mentioned i have only red the name.
the header is 1 header? and using parts is a problem?
can a header itself be modular or being grouped in smaller parts? then there is a stlib part 1 and part 2.
probably its a top ten stupid remark, but i had it in mind for 16k zx which has only 8k free.
but its about compiling anyway, so probably its a top 5 remark by now
cheers
User avatar
feilipu
Member
Posts: 45
Joined: Tue Nov 15, 2016 5:02 am

Re: Future of the libraries

Post by feilipu »

the header is 1 header?
Doesn't apply to z88dk libraries, rather to external libraries that are added to the third-party directories by the user.

I'm speaking specifically about z88dk-lib tool, which can automatically generate and install newlib libraries and headers for sdcc, sccz80, and clang.

The discussed limitation is that only 1 header file can be processed automatically per library install. Not a huge problem, but one apparent when the library has a separate configuration header file (for example), which then has to be then handled (installed) manually.
using parts is a problem?
It is an old issue, and the reason why there are so many single function files in z88dk. The assembler / linker can't do the equivalent of gcc -ffunction-sections. So if one function is used in a library, then they're all linked in.
cborn
Well known member
Posts: 267
Joined: Tue Oct 06, 2020 7:45 pm

Re: Future of the libraries

Post by cborn »

I dont want to turn this in a tut HOLA! (tutorial and 'tuthola' is a dutch word)

But it seems that there are unlimited variations on "stdio.h" alone.
I found an "stdio.h" which is so brute to INCLUDE another stdio.h in itself
https://code.woboq.org/userspace/glibc/ ... dio.h.html

meanwhile i found 6(?) different one on z88dk alone.
Instead off excluding parts of headers , ALL headers should be build by a menu
If i get i rigth the "standard" headers are merely a SERVICE from the compiler not to have to make the header yourself, which very often is a real piece of code aswel, not just the mentioning of that part.
the build of the 'normal' headers is given here
https://www.tutorialspoint.com/c_standa ... tdio_h.htm
https://www.geeksforgeeks.org/whats-dif ... tween-and/

so, with my know_no_knowledge i would say that its better to build a single "main.h" with pure and only those components needed.
pseudo_pseudo_code

void Jump_Over_Main{ struct main.h}
struct main.h{
//include list
fopen.h
fclose.h
}

void main{}
//and the rest of my fantasy
int fantasy{
return the end;
}
sorry if it breaks the tread,
but building up seems easier then breaking down or excluding from an inclusion
cheers
chris
sromero
New member
Posts: 2
Joined: Wed Nov 15, 2023 9:29 am

Re: Future of the libraries

Post by sromero »

Sorry to wake up again this old topic in 2023...

Last time I used z88dk it was on 1.5 (almost 20 years ago!).

I recently wanted to check if the compiler was still under development and maybe complete some old ZX Spectrum games I left unfinished 15 years ago.

From this page I understood that there was a "Classic Library" and a "New Library" and that the New library was the future. I understood from the project description and the tutorials that NewLib was still under development but that it was "the way to go". That everything was being ported from Classic to New and at some point in the future, the new lib would be the standard and the classic would be there just for backward compatibility.

I joined an Spanish channel about z88dk in telegram and there I was informed about this thread and about the possibility that the newlib is probably a "dead end", based on this thread.

The thread is from 2020... could anybody update me on the current state of the art of the libraries? Is Classic Lib the way to go as of 2023? Has the "NewLib" development re-taken, or after 3 years is more clear than in 2020 that Classic Lib is the future right now?

Thanks for any clarification, I don't want to invest time in the "wrong library"...
User avatar
feilipu
Member
Posts: 45
Joined: Tue Nov 15, 2016 5:02 am

Re: Future of the libraries

Post by feilipu »

Almost all of the code in the newlib has been incorporated into classic, so it has achieved the modernisation goal set out in the most part.

The exceptions are targets in newlib that use the abstractions in the serial port instantiation and device drivers, etc. There needs to be an integrated solution for them at some stage.

However it is also possible to make a newlib target use classic serial too. The example is the +rc2014 target and its 8085 subtypes (basic85 and acia85).

So IMHO it isn’t really a question anymore of which way to go, unless you intend (need) to create a new target then the answer would be to build it within the classic library structure.

To the question of compilers being finished, I’d say that both sccz80 and sdcc are equally good and equally finished, with sccz80 working best on machines where index register usage is comparatively slow (or non-existent), and sdcc best when you have time for deep compile time optimisation of large functions.

Hope that helps.
Timmy
Well known member
Posts: 392
Joined: Sat Mar 10, 2012 4:18 pm

Re: Future of the libraries

Post by Timmy »

If your code is over 10 years old, then you'll probably find you can use the same combination as back then, sccz80 and the "classic" library.

There have been some changes however, and I had some exchanges with dom about it iwhen I was trying to update FBS.
It's probably useful to you as well: viewtopic.php?t=11492

If you have any problems with updating your code to the nightly(!) -- there are still plans for a regular version -- just post it here, or make a new thread, and I can see if I can help with updating.
sromero
New member
Posts: 2
Joined: Wed Nov 15, 2023 9:29 am

Re: Future of the libraries

Post by sromero »

Timmy wrote: Wed Nov 15, 2023 5:04 pm If your code is over 10 years old, then you'll probably find you can use the same combination as back then, sccz80 and the "classic" library.
My code is over 10 years old but my programming skills are now 10 years better, so I was thinking to rewrite everything.

Example: most of my ASM is inlined with #asm and #endasm and I'd like to rewrite it now in external ASM files with PUBLIC/EXTERN/SECTION/etc directives, and I'd like to choose wisely to avoid redoing everything in 2033 when I come back to re-finish them =D
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Re: Future of the libraries

Post by stefano »

> to avoid redoing everything in 2033 when I come back to re-finish them =D

Don't bet on it ! :D
Well, as Felipu said you can get most of the newlib benefits also in the classic library now. My personal taste goes to the classic library because I'm a mainac of portability. People wishing to squeeze out the best from a Spectrum at any cost sometimes chooses the newlib, I can't say whether it is the way to succeed (expecially if you are integrating it with custom assembly code already), but surely porting your project to different computer models would be more tricky.
Post Reply