Page 1 of 1

Incorrect prototype conversion in C by pbcompilerc

Posted: Sun Nov 10, 2024 6:14 pm
by gdig
Hi,

I'm a long-time user of PureBasic (so great software) but new to the forum.
I wanted to report a bug that occurred in the recent PureBasic 6.12 LTS (I also got this bug in 6.11).

I have this PB code:

Code: Select all

Prototype.i ProtoCallbackDialog(dlgMessage.i, hWnd, dlgControl)

ProcedureDLL.i AfficheDialogue(dialogueid.s, pointeur_fonction_callback.ProtoCallbackDialog)
etc
When I compile it with the C purebasic compiler, it translates to:

Code: Select all

typedef integer (*pf_protocallbackdialog)(integer v_dlgmessage,integer v_hwnd,integer v_dlgcontrol);
As no specific calling convention is defined in the C file, this defaults to __cdecl on Windows.

However, in the help, it is said that by default the function will use the standard call convention (stdcall on x86, or fastcall on x64). If the function pointer will be a C one, the PrototypeC variant should be used instead.

This causes my program to fail in 32-bit since it expects stdcall.

Is there something I'm missing or is it a bug of the pbcompilerc?

Thank you!

Re: Incorrect prototype conversion in C by pbcompilerc

Posted: Mon Nov 11, 2024 7:25 pm
by User_Russian
gdig wrote: Sun Nov 10, 2024 6:14 pmWhen I compile it with the C purebasic compiler, it translates to:

Code: Select all

typedef integer (*pf_protocallbackdialog)(integer v_dlgmessage,integer v_hwnd,integer v_dlgcontrol);
I have PB 6.12 x86, the prototype is translated into

Code: Select all

typedef integer (__stdcall *pf_protocallbackdialog)(integer v_dlgmessage,integer v_hwnd,integer v_dlgcontrol);
Maybe you looked at the C code translated by the x64 version?

Re: Incorrect prototype conversion in C by pbcompilerc

Posted: Fri Dec 20, 2024 5:46 pm
by Fred
I can confirm the stdcall is properly set in pbcompilerc, may be it's another issue @gdig ?