Alas, it did not solve the bug related to my 8000+ line program(s) (basically forward declaration problems).
No problem when compiling using the assembler front end. One error when using the gcc back end and the non - OOP version.
Some more errors when I use the OO version of the same program. All errors disappear when using -g (it's a kinda magic :) ).
One error that has to do with declarations might be of importance.
final.c:675: error: conflicting types for 'malloc'
final.c:675: error: conflicting types for 'malloc'
My program includes stdlib.bi and calls the function malloc. malloc is defined like so in stdlib.bi:
declare function malloc (byval as size_t) as any ptr
whereas the C code produced by -gen gcc contains this
void malloc(integer)
In the resulting source code I get this
void* malloc( integer );
//other lines
void* malloc( uinteger );
The first declaration of malloc (integer type argument) was put in by the C back end, the other is from stdlib.bi. Actually the uinteger started out as a size_t which is defined as an alias for uinteger (at least on win32 it is).
According to the C standard the argument to malloc should be size_t. Both on Linux and Windows size_t is defined as an uinteger (unsigned integer) so I am quite sure void* malloc( integer) is wrong. The problem is that the rtlib introduces a malloc with an integer argument. I got the error due to the the use of one call to allocate. If I change that to callocate all is well again as no prototype for malloc is created by the C back end (and the one put in by including stdlib.bi is correct).
Prototypes added to the code by the fb rtlib can conflict with prototypes added by including a file from the crt. If I would have used calls to callocate and calloc the same problem would have occurred (calloc is defined using an argument of type size_t, not integer).
callocate, allocate and reallocate are thin wrappers around calloc, malloc and realloc. If you mix calls to the wrappers with calls to the wrapped functions chances are the code will not compile. Fixing this could be a matter of fixing the types used by the thin wrappers.
size_t is defined the same on linux/windows (unsigned integer) but not on dos (there size_t is defined as an ulong).