FreeBASIC 1.08 Development

General discussion for topics related to the FreeBASIC project or its community.
Post Reply
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: FreeBASIC 1.08 Development

Post by MrSwiss »

erik wrote:Does this need to be corrected?
No, this is the definition that is more 'general' than coderJeff's which is, as stated 'ptr' specific.
This means: it throws 'warnings' when used with Integer (any size) or Boolean types.

The 'general' version doesn't throw those 'warnings' see my "proof of concept" code (compile/run it).
coderJeff
Site Admin
Posts: 4316
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: FreeBASIC 1.08 Development

Post by coderJeff »

'#define NULL 0' is a carry over from some really old translations of C headers. Not exactly wrong but we could do better.

As RockTheSchock already indicated, something like '#define NULL cptr( any ptr, 0 )' would give the correct overloaded function resolution because instead of a plain literal zero it has better type information associated with the null pointer symbol NULL. A NULL typed as a pointer carries more meaning than plain old zero.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: FreeBASIC 1.08 Development

Post by MrSwiss »

Recommendation for NEW GCC-backend for WIN 32/64 'standalone' builds.

After having run a sizeable amount of testing with GCC 8.4 WinLib (1.07.3 release),
without any error and, just a warning on BASE1 static sized string-array, including:
32/64-bit DLL (Win) I'd propose:

GCC 8.4 WinLib as NEW backend for upcoming FBC 1.08.0 release
(in the 'standalone' WIN + GCC packages!)
Cretin Ho
Posts: 182
Joined: Feb 04, 2021 13:01

Re: FreeBASIC 1.08 Development

Post by Cretin Ho »

@coderJeff: are you interested in supporting Pelles C as the C compiler in addition to GCC? Pelles C is more lightweight than MinGW and generate standalone binary. I know I could have fbc generate C source for me then I could compile them with whatever C compiler I want. I mean the ability of fbc to invoke Pelles C to compile the code automatically like that with GCC. I afraid Pelles C is too different from GCC. It's more in line with MSVC, I think. I don't know if the assembly generated by fbc will compatible with poasm or not, too.
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: FreeBASIC 1.08 Development

Post by deltarho[1859] »

MrSwiss wrote:Recommendation for NEW GCC-backend for WIN 32/64 'standalone' builds.
Seconded with gcc 5.2 as an additional.
coderJeff
Site Admin
Posts: 4316
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: FreeBASIC 1.08 Development

Post by coderJeff »

To properly set this up, there's a ton of stuff I need to write to explain how this gcc version change fits in to what I think is the big picture.
So let's skip that and very briefly:
- New gcc version, good.
- Not easy, why?

We've been using gcc-5.2 as a kind of short hand for the fbc's current toolchain on windows but there's more to it than just which gcc version.

Rough Outline of fbc's (gnu) toolchain
Making fb programs:
- mingw-w64 runtime & libraries
- binutils (assember, linker, etc)
- gcc (both for building fbc/rtlib/gfxlib2 sources and user sources under -gen gcc)
- "external" libraries (zlib, libffi, etc)
- fb bindings (.bi files)
- fb libraries (fbcrt0.o, libfb, libgfx2, etc)
- fbc.exe compiler

Debugging/Developing:
- gdb

Developing:
- make
- unix like tools and shell

Getting to the next version of gcc
"gcc-5.2" what we actually have is:
- mingw-w64 version 4 (includes winapi headers, we patch in directx)
- binutils version 2.25
- gcc version 5.2.0
- fb bindings (i.e. windows.bi/*) generated from mingw-w64 version 4 headers
- Plus all the other bits like makefile, build & release scripts, etc.

All the pieces need to work together and it can get painful if there are pieces that don't get along. It's best to have a matched set, but if can't maybe can get close. Or build the entire toolchain from sources and patch all the problems. Ideally, it would be nice to download a popular package and have it mostly work. Some trust in the toolchain by many people using it, I guess.

So, for the next version:
- the gcc and binutils are easy, they are usually the main parts of a ready-made toolchain offered for download.
- the existing fb bindings made against mingw-w64-rt-v4 are probably OK to test things out, but should also check what differences come up on newer runtime versions.
- For the winlibs builds, all of the mingw-w64 runtimes are same version, so that could help bindings.
- depending on which gcc version.

For developing, I absolutely need a working gdb. For the gcc-8.x toolchains released with 1.07.3, none of them have a usable gdb. I can still use gdb 7.6.1 from mingw-org for the 32-bit stuff, but for 64-bit I have to use gdb-7.11.1 from mingw-w64 w/gcc-7.1. It has dependencies, so it's tricky with PATH and so on. Anyway, I can work around it.
coderJeff
Site Admin
Posts: 4316
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: FreeBASIC 1.08 Development

Post by coderJeff »

Cretin Ho wrote:@coderJeff: are you interested in supporting Pelles C as the C compiler in addition to GCC?
Not really. Pelles C is a convenient package though. I've used it often.

I really just want to push fbc-1.08.0 out the door.
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: FreeBASIC 1.08 Development

Post by deltarho[1859] »

I liken coderJeff's previous post to my replacing my old car's engine with a Ferrari engine and then realizing that the suspension and brakes need looking at among a few other things.

If coderJeff manages to achieve all that he wants to achieve fbc 1.08 will be a new era for FreeBASIC. It will be a formidable achievement given that he is not a member of a large team as is the case with gcc development.
angros47
Posts: 2321
Joined: Jun 21, 2005 19:04

Re: FreeBASIC 1.08 Development

Post by angros47 »

Any new development about ABI compatibility?
coderJeff
Site Admin
Posts: 4316
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: FreeBASIC 1.08 Development

Post by coderJeff »

angros47 wrote:Any new development about ABI compatibility?
No. None. I have a few notes and barely a start on it in my local dev repo. I assume you mean only the additional constructor because even with that done there's still way more.

There's lots of things I would have liked to have for fbc-1.08.0, but if I had to pick two things:
- revisit screeninfo, screencontrol, imageinfo taking long data types. Very minor fb source breaks for 64bit, but I think users will live with it to get long types
- maybe the extra constructor on types just because of the binary change. If not though, fbc-1.08.x is the place to do it due the other binary changes.
coderJeff
Site Admin
Posts: 4316
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: FreeBASIC 1.08 Development

Post by coderJeff »

Here's the roadmap for fbc-1.08.x on windows:
Goal is to make the changes in increments with the idea that problem solving small changes are going to be easier than fixing problems in a massive change across multiple components.

Summary for fbc-1.08.x:
- winlibs-gcc-9.3.0 SJLJ as default
- gcc-5.2 as alternate
- we eventually want to a newer gcc/clang/llvm, for the backends but I want anyone that actually depends fbc(+gcc-5.2) to still have an option here.

Roadmap for 1.08.x

gcc-5.2
- release with fbc-1.08.0 as alternate package
- currently uses mingw runtime version 4
- fbc windows headers are translated from mingw runtime version 4
- tag windows header version 1.07.3 in fbbindings.git
- going forward there's no guarantee that new headers will work with old mingw runtimes

gcc-7.x
- update fbc windows headers against mingw runtime version 5
- no release package

gcc-8.x
- update fbc windows headers against mingw runtime version 6
- no release package
- FYI, GDB not usable

winlibs-gcc-9.3.0 SJLJ
https://github.com/brechtsanders/winlib ... .0-sjlj-r3
- this is one of the few packages that are built with SJLJ exception handling (what we currently use).
- update fbc windows headers against mingw runtime version 7
- progress the fbc bfd headers to get to binutils 2.34
- fix the new gcc warnings
- use as default for fbc-1.08.0
- passes our current test-suite
- gdb still broken
- hopefully the change in threading model doesn't give troubles
- FYI, GDB not usable, no GDB included
- for sure, binary changes from gcc-5.2 and previous binutils
- array warning seems to be gone - still verifying

winlibs-gcc-9.3.0
https://github.com/brechtsanders/winlib ... 0-7.0.0-r4
- switch to Dwarf2/SEH libraries
- better testing for the change from SJLJ exception handling in both 32-bit and 64-bit to Dwarf2 in 32-bit and SEH in 64-bit
- for plain C programming shouldn't matter
- test effects on signal handlers and setjmp/longjmp codes
- FYI, GDB not usable, no GDB included

winlibs-gcc-10.2.0 Mingwrt 7
https://github.com/brechtsanders/winlib ... 0-7.0.0-r4
- update gcc only, mingw runtime is still version 7
- fails a couple tests in the test-suite due a bug somewhere in printf and fbc's FORMAT
- GDB works again! - lots of dependencies though so probably still no GDB included

winlibs-gcc-10.2.0 Mingwrt 8
https://github.com/brechtsanders/winlib ... 0-8.0.0-r8
- update fbc windows headers against mingw runtime version 8
- fails a couple tests in the test-suite due a bug somewhere in printf and fbc's FORMAT
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: FreeBASIC 1.08 Development

Post by deltarho[1859] »

- winlibs-gcc-9.3.0 SJLJ as default

Image
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FreeBASIC 1.08 Development

Post by VANYA »

deltarho[1859] wrote:- winlibs-gcc-9.3.0 SJLJ as default

Image
Friends, please explain. So there will be a default package in the new 1.08 release that won't support GDB debugging?
If so, then I don't know what deltarho is applauding...
marcov
Posts: 3455
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: FreeBASIC 1.08 Development

Post by marcov »

fwtw: I don't know exactly what your GDB problem is, Lazarus keeps newer GDB's for testing purposes on sf.net:

32-bit https://sourceforge.net/projects/lazaru ... ive%20GDB/
64-bit https://sourceforge.net/projects/lazaru ... ive%20GDB/

Since FPC only changed to SEH for 32-bit last May, most of the 32-bit ones will probably also do SJLJ. 64-bit has been SEH for a very long time.
angros47
Posts: 2321
Joined: Jun 21, 2005 19:04

Re: FreeBASIC 1.08 Development

Post by angros47 »

coderJeff wrote: No. None. I have a few notes and barely a start on it in my local dev repo. I assume you mean only the additional constructor because even with that done there's still way more.
Yes, I meant that. I have the impression it would be enough to be able to port the FLTK library to FreeBasic in OOP mode
Post Reply