Weird output when printing the result of a comparison

General FreeBASIC programming questions.
SARG
Posts: 1763
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Weird output when printing the result of a comparison

Post by SARG »

I found the reason after debug at asm level.

When print function is called the parameter indicating skip to next line or stay on the same line is pushed on stack very early.
There is a problem with the calling convention so the parameters of the solvemate function are not cleaned and the stack is not anymore correct when print is called, the parameter has been replaced by anything.

The solution is to add 'cdecl' when defining solvemate :

Code: Select all

dim SolveMate as function cdecl ( _
  byval as const zstring ptr, _
  byval as const integer, _
  byval as const integer _
) as zstring ptr
Edit : cdecl default for Linux and on 64bit only one convention (even different ABI) so no problem

Edit bis : I forgot to thank dodicat so thank you for the dll. :D
Last edited by SARG on Jun 14, 2022 22:11, edited 1 time in total.
Roland Chastain
Posts: 1002
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: Weird output when printing the result of a comparison

Post by Roland Chastain »

Great, thank you very much!
SARG wrote: Jun 14, 2022 21:53 Edit : cdecl default for Linux and on 64bit only one convention (even different ABI) so no problem
OK, all is clear now.

Thank you all for your kind help. :)
Post Reply