Coping with underscore decoration conventions

Discussion in 'C Programming' started by AntiPasta, Jul 10, 2005.

  1. AntiPasta

    AntiPasta Guest

    A good day to you all,

    I had an old code project lying around, written in C + assembly and
    targeted for X86 Linux, that I intended to compile on Win32 as well.
    I'm using GCC and NASM on Linux (not really sure which version but
    nothing too esoteric), and MingW and NASM on Windows. I quickly ran
    into the problem of differing calling conventions between Linux and
    Windows: my assembly code exports several symbols, but the MingW GCC
    won't link to them unless I prepend a _ to the symbol names, whereas
    GCC on Linux seems not to care about this. I guess I can add an
    underscore to the required variable names, but I intended to retain
    code portability - is there a way around this?
    Thanks in advance.
    AntiPasta, Jul 10, 2005
    #1
    1. Advertising

  2. In article <>,
    AntiPasta <> wrote:
    >A good day to you all,
    >
    >I had an old code project lying around, written in C + assembly and
    >targeted for X86 Linux, that I intended to compile on Win32 as well.
    >I'm using GCC and NASM on Linux (not really sure which version but
    >nothing too esoteric), and MingW and NASM on Windows. I quickly ran
    >into the problem of differing calling conventions between Linux and
    >Windows: my assembly code exports several symbols, but the MingW GCC
    >won't link to them unless I prepend a _ to the symbol names, whereas
    >GCC on Linux seems not to care about this. I guess I can add an
    >underscore to the required variable names, but I intended to retain
    >code portability - is there a way around this?
    >Thanks in advance.
    >


    <OT>
    The usual method is to define macros that are turned on in the Winders
    compiles.
    </OT>
    Kenny McCormack, Jul 10, 2005
    #2
    1. Advertising

  3. AntiPasta

    AntiPasta Guest

    >
    > <OT>
    > The usual method is to define macros that are turned on in the Winders
    > compiles.
    > </OT>


    Well, actually, I'd need to define macros in NASM to do this, but that
    is probably impossible in this case. I was looking for a way to get
    MingW to "forget" the underscores.
    AntiPasta, Jul 11, 2005
    #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. Lucas Tam

    Coping Txt file to client PC ?

    Lucas Tam, Aug 19, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    337
    Frank Drebin
    Aug 19, 2003
  2. manolakis

    coping an object

    manolakis, Nov 13, 2006, in forum: Java
    Replies:
    0
    Views:
    439
    manolakis
    Nov 13, 2006
  3. Gigs_

    coping directories

    Gigs_, Feb 2, 2007, in forum: Python
    Replies:
    6
    Views:
    272
    Gabriel Genellina
    Feb 2, 2007
  4. Microsoft Newsserver

    Coping with slow SQL Servers in ASP.NET

    Microsoft Newsserver, Feb 1, 2008, in forum: ASP .Net
    Replies:
    4
    Views:
    457
    Cowboy \(Gregory A. Beamer\)
    Feb 1, 2008
  5. Replies:
    0
    Views:
    73
Loading...

Share This Page