Who define __cdecl, __stdcall, etc...

Discussion in 'C++' started by kwijibo28, Jun 5, 2006.

  1. kwijibo28

    kwijibo28 Guest

    Hi all,

    I was wondering if there is a standard definition for the calling
    convention like __cdecl and __stdcall. I've search the c++ standard
    document and there is no mention of __cdecl or __stdcall. I'm not very
    surprise, for the committe, how to pass argument from a function to an
    other, must be an implementation detail left to the compiler vendor.

    But since in real life people write library which are build with a
    compiler and use possibly by another compiler, compiler vendor must
    agree on a common definition. I guess that definition should also
    specify how to decorate function name according to a calling
    convention.

    I'm asking this question because recently I've build a dll with a MS
    compiler and my client had a borland and we've found out that both
    compiler don't agree on function decoration for __cdecl and __stdcall.

    Thanks
    Kwijibo28
     
    kwijibo28, Jun 5, 2006
    #1
    1. Advertisements

  2. kwijibo28

    Mike Smith Guest

    Neither of those vendor-specific directives have anything to do with C++
    name-mangling - they refer instead to argument passing and stack
    cleanup. Sadly, no two vendors seem to agree on a name-mangling scheme,
    which leaves us relying on COM, CORBA, or plain-jane C for interoperability.
     
    Mike Smith, Jun 5, 2006
    #2
    1. Advertisements

  3. Vendors are well adviced to choose different name-mangling schemes
    _unless_ their compilers are truely binary compatible. This includes
    not only function calling conventions but at least the standard library
    implementation, virtual tables, exception handling and RTTI. This would
    indeed tie the two implementations very closely together.
     
    Markus Schoder, Jun 5, 2006
    #3
  4. kwijibo28

    kwijibo28 Guest

    Alright thanks for the info,

    I will try to provide a plain C interface for my dll then. And I will
    continue my investigation in a C forum. (I don't want to get flame
    because I'm getting off-topic!)

    Kwijibo28
     
    kwijibo28, Jun 6, 2006
    #4
  5. kwijibo28

    Mike Smith Guest

    Well, yes. What I should have said was "sadly, on most platforms, there
    is no commonly accepted C++ ABI that allows interoperability between
    compilers".
     
    Mike Smith, Jun 6, 2006
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.