Thread: Virtual function and multiple inheritance

  1. #61
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I expect that not to be the case - the executable format has very little to do with the calling convention - it may state that standard DLL's should use stdcall calling convention, but if you really want to you can create a DLL that uses fastcall, cdecl or thiscall calling convention - or any mixture of all four. The PECOFF manual describes how to relocate an executable file, how to find symbols in it, etc, etc, but not how to use assembler code - that is not part of the PECOFF format itself.

    The fact that the executable contains functions is for most purposes irrelevant (and in fact, the executable may only contain one function that never calls any other function).

    I have a feeling that Microsoft doesn't have a ABI specification. A quick search doesn't find anything at all.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  2. #62
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Interesting, Mats!


    What topics do you expect the so-called ABI manual for Windows to have?

    Quote Originally Posted by matsp View Post
    I expect that not to be the case - the executable format has very little to do with the calling convention - it may state that standard DLL's should use stdcall calling convention, but if you really want to you can create a DLL that uses fastcall, cdecl or thiscall calling convention - or any mixture of all four. The PECOFF manual describes how to relocate an executable file, how to find symbols in it, etc, etc, but not how to use assembler code - that is not part of the PECOFF format itself.

    The fact that the executable contains functions is for most purposes irrelevant (and in fact, the executable may only contain one function that never calls any other function).

    I have a feeling that Microsoft doesn't have a ABI specification. A quick search doesn't find anything at all.

    --
    Mats

    regards,
    George

  3. #63
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    An ABI manual will describe the state before & after function calls, such as which registers are used for what, which registers are caller save, callee save and which are "scratch" registers [that is, the ones that aren't saved by caller or callee, so will change over a function call].

    It will also describe things like "how to unwind the stack during exception handling" and such things.

    There are a heap of ABI specs on this page:
    https://www.linux-foundation.org/dba...e/standard.php

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #64
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    To put it simply, calling convention is a set of rules of how arguments are passed, on the stack or in some registers, in what order the arguments are passed, which function cleans the stack, etc.
    MS uses 4 of them: __cdecl, __stdcall, __fastcall and __thiscall.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #65
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Thanks matsp and Elysia,


    I have got your ideas. Seems there is no open document (including some internal documents on Microsoft System Journal) covers the details in calling convention?

    Quote Originally Posted by Elysia View Post
    To put it simply, calling convention is a set of rules of how arguments are passed, on the stack or in some registers, in what order the arguments are passed, which function cleans the stack, etc.
    MS uses 4 of them: __cdecl, __stdcall, __fastcall and __thiscall.

    regards,
    George

  6. #66
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    No, for calling conventions there is. Mats posted a link:
    http://msdn2.microsoft.com/en-us/lib...ks(VS.71).aspx

    For ABI, there probably isn't.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #67
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Thanks Elysia,


    What I mean is the binary (assembly language level) description of calling convention.

    Quote Originally Posted by Elysia View Post
    No, for calling conventions there is. Mats posted a link:
    http://msdn2.microsoft.com/en-us/lib...ks(VS.71).aspx

    For ABI, there probably isn't.

    regards,
    George

  8. #68
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by George2 View Post
    Thanks Elysia,


    What I mean is the binary (assembly language level) description of calling convention.




    regards,
    George
    It is described in the link - what else do you think EAX, ECX, EDX etc refers to, if not assembler instructions.

    If you don't understand how to interpret the calling conventions, perhaps you should study assembler programming in general for a little bit.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  9. #69
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Thanks for your patience help on this thread, Mats!


    Quote Originally Posted by matsp View Post
    It is described in the link - what else do you think EAX, ECX, EDX etc refers to, if not assembler instructions.

    If you don't understand how to interpret the calling conventions, perhaps you should study assembler programming in general for a little bit.

    --
    Mats

    regards,
    George

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What is a virtual function pointer?
    By ting in forum C++ Programming
    Replies: 4
    Last Post: 03-05-2008, 02:36 AM
  2. Multiple Inheritance - Size of Classes?
    By Zeusbwr in forum C++ Programming
    Replies: 10
    Last Post: 11-26-2004, 09:04 AM
  3. inheritance and performance
    By kuhnmi in forum C++ Programming
    Replies: 5
    Last Post: 08-04-2004, 12:46 PM
  4. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM
  5. Exporting Object Hierarchies from a DLL
    By andy668 in forum C++ Programming
    Replies: 0
    Last Post: 10-20-2001, 01:26 PM