I had problems here to compile a program with #include msx.h
msx.h does not declare the function prototypes that not receive arguments with (void), it declares ()
The modern compilers warn that, but the specific old compiler (z88dk old version) I am using does not warn that but generates an error in the compiled code.
So, if you are having some weird problem, can be that.
Complementing, my problem only occurs if the first function in msx.h is a function without arguments, only changing the order with other function solve the problem (or apparently solve), so this can cause another problem I'm not seeing, therefore I think better using (void) in all prototypes.
Example:
void func1() { } extern void __LIB__ func2(); // not compile // extern void __LIB__ func2(void); // compile int main() { func1(); return 0; }
ASM generated with error:
;* * * * * Small-C/Plus z88dk * * * * * ; Version: 20070909.1 ; Reconstructed for the z80 Module Assembler ; Module compile time: Wed Mar 27 18:19:50 2019 MODULE test2.c INCLUDE "#z80_crt0.hdr" ._func1 ret ._main call func1 ld hl,0 ;const ret ; --- Start of Static Variables --- ; --- Start of Scope Defns --- XDEF func1 LIB func2 XDEF _main ; --- End of Scope Defns --- ; --- End of Compilation ---
It removes the _ of func1 at call and XDEF
Login or register to post comments