You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am a native rust coder so take this with a grain of salt:
My understanding is that when you are creating a library it is best practice to define the calling convention because someone may be using a different default and then when they try to link with your code it will fail without first re-writing your header.
It should be possible to just add __cdecl if it is extern "C" or __stdcall if it is extern "stdcall" and so on.
Specifically the request here is to allow explicitly saying __cdecl on functions, since right now function prefix/postfix settings won't allow putting this into the declarations.
The text was updated successfully, but these errors were encountered:
mattiekat
changed the title
Support calling convention definitions
Support calling convention specification
Oct 12, 2021
It would be useful to always specify the calling convention.
I came across this issue because I hit linker errors with unresolved externals because somebody was passing the /Gz flag to VC++. This option says "make all unannotated functions stdcall" and my Rust functions were compiled with the default (cdecl).
For now I think my only option is to edit the cbindgen generated header because I can't know which compiler flags will be used.
I am a native rust coder so take this with a grain of salt:
My understanding is that when you are creating a library it is best practice to define the calling convention because someone may be using a different default and then when they try to link with your code it will fail without first re-writing your header.
It should be possible to just add
__cdecl
if it isextern "C"
or__stdcall
if it isextern "stdcall"
and so on.Specifically the request here is to allow explicitly saying
__cdecl
on functions, since right now function prefix/postfix settings won't allow putting this into the declarations.The text was updated successfully, but these errors were encountered: