Re: name mangling

Discussion in 'C++' started by Pawel Dziepak, Nov 3, 2008.

  1. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Megalo wrote:
    > why not make "name mangling" of C++ standard so should be possible
    > to call
    > the classes and the functions of C++ from other C++ compiler
    > [and other language too]
    > thanks


    C++ describes the programming language, not the way it is implemented.

    For example, if somebody wants to create C++ runtime environment similar
    to Java/.NET's ones, C++ standard compliance won't be broken. If
    standard had described implementation details, it wouldn't have been
    possible not to disobey some paragraphs.

    Current situations, allow compilers creators to easily introduce new
    ideas and mechanism that probably will make result code more efficient.

    If you really want to call C++ function from other binaries you can use
    things like:
    extern "C" int function();

    Pawel Dziepak
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.9 (GNU/Linux)
    Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

    iEYEARECAAYFAkkO6ogACgkQPFW+cUiIHNrV1ACeJE/Q7gq88+4RIZT1gxzQK1QN
    rmsAnRHfHIM2C2ghr7vzCuxyIuQUYCVF
    =SM84
    -----END PGP SIGNATURE-----
    Pawel Dziepak, Nov 3, 2008
    #1
    1. Advertising

  2. Pawel Dziepak

    James Kanze Guest

    On Nov 3, 2:41 pm, "Megalo" <> wrote:
    > "Pawel Dziepak" <> ha scritto nel
    > messaggionews:gempq9$4m5$...


    [...]
    > > Current situations, allow compilers creators to easily
    > > introduce new ideas and mechanism that probably will make
    > > result code more efficient.


    > > If you really want to call C++ function from other binaries
    > > you can use things like:
    > > extern "C" int function();


    > better
    > extern  "C++"  int function();


    That's the default.

    > because extern "C" has already the meaning for "C function"


    I think his point was that almost all other langauges have the
    capability to call a C function, so if you make your C++
    function look like a C function, they can call it.

    --
    James Kanze (GABI Software) email:
    Conseils en informatique orientée objet/
    Beratung in objektorientierter Datenverarbeitung
    9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
    James Kanze, Nov 3, 2008
    #2
    1. Advertising

  3. Pawel Dziepak

    James Kanze Guest

    On Nov 4, 10:01 am, "Megalo" <> wrote:
    > >"James Kanze" <> ha scritto nel messaggio
    > >news:6582fa2d-0c67-4493-9207->7c157227e__BEGIN_MASK_n#9g02mG7!__...__END_MASK_i?a63jfAD$...
    > >On Nov 3, 2:41 pm, "Megalo" <> wrote:
    > >> "Pawel Dziepak" <> ha scritto nel
    > >> messaggionews:gempq9$4m5$...
    > >> > extern "C" int function();
    > >> better
    > >> extern "C++" int function();

    > >That's the default.
    > >> because extern "C" has already the meaning for "C function"

    > >I think his point was that almost all other langauges have the
    > >capability to call a C function, so if you make your C++
    > >function look like a C function, they can call it.


    > so you think that a
    > C++ [class] function in a .dll file
    > could have a name usable of a C language?


    Who cares about the name? Obviously, another language cannot
    call a C++ member function unless it also knows how the C++
    compiler implements classes, etc.

    > i would say their name should be the argument size they have,
    > its individual size the way of call that function (stdcall
    > ccall etc)


    Why? Once you've said `extern "C"', you've told the compiler
    all it needs to know.

    --
    James Kanze (GABI Software) email:
    Conseils en informatique orientée objet/
    Beratung in objektorientierter Datenverarbeitung
    9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
    James Kanze, Nov 5, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. abhijeet.s
    Replies:
    8
    Views:
    4,411
    Jean-Francois Briere
    Feb 3, 2006
  2. sunny

    Name Mangling in DDK

    sunny, Jul 9, 2004, in forum: C++
    Replies:
    4
    Views:
    444
    Robert Wessel
    Jul 10, 2004
  3. Tim Slattery

    Name-mangling standard?

    Tim Slattery, Sep 2, 2004, in forum: C++
    Replies:
    1
    Views:
    1,830
    Thomas Matthews
    Sep 2, 2004
  4. Randy Yates
    Replies:
    2
    Views:
    512
    Randy Yates
    Jan 4, 2005
  5. Replies:
    6
    Views:
    400
    E. Robert Tisdale
    Sep 8, 2005
Loading...

Share This Page