Re: ver 4.0 c_func problem on WIN98 Here Is proof of the problem !
- Posted by jimcbrown (admin) Apr 24, 2009
- 1170 views
My code does not have any thing to do with changing the return type.
Not the return type, but (the C variable that is internal to Euphoria) return_type.
If you will note that the return type is set up in the define_c_func by a C_ULONG which is NOT controlled by my program code but internally by Euphoria.
This information (the C_ULONG) is stored in return_type, however, so if return_type gets changed then the information is lost. Watcom makes the return_type variable the same as the ESI register.
No matter what is done to the ESI register internally in my code; it should not effect the external Euphoria code.
What Matt is saying is that your machine code is clobbering a register.
If you saved all registers before your machine code starts and then restored all registers before your machine code returns, that would fix the bug.
Now the question is, is the bug Watcom's fault or not? In other words, should the compiler be saving and restoring registers for us or is your machine code suppose to do that? This is beyond the internals of Euphoria, but entering the realm of the internals of Watcom C, the realm of the Watcom developer team.