It's good to know that generating C code from BAS finally works right out of the box.
So, I tried compiling FBC_ROOT\examples\compression\zlib.bas via:
Code: Select all
fbc -gen gcc -R -m zlib -v zlib.bas
I tried to compile the ZLIB.C file by replicating what FBC did as shown by `verbose':
Code: Select all
FBC_ROOT\bin\win32\gcc.exe -m32 -S -nostdlib -nostdinc -Wall -Wno-unused-label -Wno-unused-function -Wno-unused-variable -Wno-main -Werror-implicit-function-declaration -O0 -fno-strict-aliasing -frounding-math -fno-math-errno -mtune=i486 "zlib.c" -o "zlib.asm"
FBC_ROOT\bin\win32\as.exe --32 --strip-local-absolute "zlib.asm" -o "zlib.o"
FBC_ROOT\bin\win32\ld.exe -o "MYZLIB.EXE" -subsystem console "FBC_ROOT\lib\win32\fbextra.x" --stack 1048576,1048576 -s -L "FBC_ROOT\lib\win32" -L "." "FBC_ROOT\lib\win32\crt2.o" "FBC_ROOT\lib\win32\crtbegin.o" "FBC_ROOT\lib\win32\fbrt0.o" "zlib.o" "-(" -lz -lfb -lgcc -lmsvcrt -lkernel32 -lmingw32 -lmingwex -lmoldname -lsupc++ -lgcc_eh "-)" "FBC_ROOT\lib\win32\crtend.o"
To my surprise, not only FBC could generate C code, GCC can actually compile the code!
Problem is, upon running both ZLIB.EXE and MYZLIB.EXE, the both crashed! :(
The output was:
Code: Select all
warning: different zlib version
zlib version 1.2.6 = 1260 compile flags = 55
uncompress(): hello, hello!
{crashed!}
Running the newly recompiled ZLIB.EXE worked like a charm.
Somehow, it seemed to be that the FBC-generated ASM file works better than the ASM file produced by AS.EXE from the FBC-generated C file.
Could this possibly a bug in the emitter? o.O
I know the emitter is not a top priority for the FBC dev team, but I'd like to know if anyone else had the same issue and had a workaround?
~creek23