Why does the compiler treat extern "C"
and extern "cdecl"
as different conventions?
I’m not familiar with calling conventions and extern
in Rust myself, but did you read an over what the various ABI strings mean in the first place? E.g. here is a list in the reference. Fairly concise of course, and I for sure couldn’t tell you in any detail what similarities and differences these entail on which platforms.
Is the fact that they are not the same a good enough reason? I'm not sure why you would expect that two different calling conventions be the same.
Can you please explain how these two differ?
From the document @steffahn linked:
extern "C"
-- This is the same asextern fn foo()
; whatever the default your C compiler supports.extern "cdecl"
-- The default for x86_32 C code.
It explicitly says that the former is a different choice for different platforms, while the latter is a calling convention for a specific platform (x86_32). They are separate things with separate meanings.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.