Re: Calling __stdcall functions in the inferior

Pedro Alves
2012-10-12T11:28:05Z

On 10/12/2012 11:41 AM, Eli Zaretskii wrote:

>> * You'll need to figure out a way to distinguish __stdcall functions
>> from "normal" functions.
>
> Does someone know where GCC stashes this info? "ptype" doesn't reveal
> this detail, AFAICS.

Not sure about debug info, but the (linker) symbol has a "@number" suffix
appended. A.k.a., "decoration". Like "symbol@4".

In gcc/config/i386/winnt.c:

/* Return string which is the function name, identified by ID, modified
with a suffix consisting of an atsign (@) followed by the number of
bytes of arguments. If ID is NULL use the DECL_NAME as base. If
FASTCALL is true, also add the FASTCALL_PREFIX.
Return NULL if no change required. */

static tree
gen_stdcall_or_fastcall_suffix (tree decl, tree id, bool fastcall)
{

As you see above, fastcall also has identifiable decoration.

I don't recall the rules or conditions of when the decoration is
stripped or not anymore.

See e.g., http://stackoverflow.com/questions/8063842/mingw32-g-and-stdcall-suffix?rq=1

--
Pedro Alves