Incorrect prototype conversion in C by pbcompilerc

Just starting out? Need help? Post your questions and find answers here.
gdig
New User
New User
Posts: 1
Joined: Sun Nov 10, 2024 6:00 pm

Incorrect prototype conversion in C by pbcompilerc

Post 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!
User_Russian
Addict
Addict
Posts: 1588
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: Incorrect prototype conversion in C by pbcompilerc

Post 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?
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Incorrect prototype conversion in C by pbcompilerc

Post by Fred »

I can confirm the stdcall is properly set in pbcompilerc, may be it's another issue @gdig ?
Post Reply