inline assemble in vc

Discussion in 'C++' started by starffly@gmail.com, Nov 25, 2006.

  1. Guest

    I overloaded operator+ in a class, and I want to invoke this
    operator in inline assemble like this:
    _asm call operator+
    but it cannot be complied OK. compiler says there are some illegalI
    opcodes, and I'm absolutely sure that all the other codes are OK.
    actually I don't know how to invoke overloaded operator in inline
    assamble, I write this referring to the deassemble code by vc. who can
    tell me how to invoke overloaded operator correctly in inline assemble.
    Thank You Very Much In Advance.
    , Nov 25, 2006
    #1
    1. Advertising

  2. Ian Collins Guest

    wrote:
    > I overloaded operator+ in a class, and I want to invoke this
    > operator in inline assemble like this:
    > _asm call operator+
    > but it cannot be complied OK. compiler says there are some illegalI
    > opcodes, and I'm absolutely sure that all the other codes are OK.
    > actually I don't know how to invoke overloaded operator in inline
    > assamble, I write this referring to the deassemble code by vc. who can
    > tell me how to invoke overloaded operator correctly in inline assemble.
    > Thank You Very Much In Advance.
    >

    Off topic here, try a group dedicated to your compiler.

    --
    Ian Collins.
    Ian Collins, Nov 25, 2006
    #2
    1. Advertising

  3. kwikius Guest

    wrote:
    > I overloaded operator+ in a class, and I want to invoke this
    > operator in inline assemble like this:
    > _asm call operator+
    > but it cannot be complied OK. compiler says there are some illegalI
    > opcodes, and I'm absolutely sure that all the other codes are OK.
    > actually I don't know how to invoke overloaded operator in inline
    > assamble, I write this referring to the deassemble code by vc. who can
    > tell me how to invoke overloaded operator correctly in inline assemble.
    > Thank You Very Much In Advance.


    operator + (a,b) is a function like any other so write a small sample
    code that uses the operator+ and get your compiler to produce some
    assembler output. Look at the actual name of the function called (turn
    off optimisation to show the function being called maybe), which will
    probably be something long and weird and use that name instead of
    operator+,

    Unfortunately some compilers change function names in assembler IIRC
    so you should check your compiler manual for details.

    Also bear in mind that if you have an optimising compiler you will
    invariably lose by using assembler ;-) but I guess its fun to see how
    the compiler does stuff so go for it...

    regards
    Andy Little

    regards
    Andy Little
    kwikius, Nov 25, 2006
    #3
  4. <> wrote in message
    news:...
    > I overloaded operator+ in a class, and I want to invoke this
    > operator in inline assemble like this:
    > _asm call operator+
    > but it cannot be complied OK.


    Why do you need to call the operator from assembly language?

    > compiler says there are some illegalI
    > opcodes, and I'm absolutely sure that all the other codes are OK.


    Humm. Better double check if you violate the instruction-set. Check the
    syntax as well...

    > actually I don't know how to invoke overloaded operator in inline
    > assamble, I write this referring to the deassemble code by vc. who can
    > tell me how to invoke overloaded operator correctly in inline assemble.
    > Thank You Very Much In Advance.
    >


    Well, you have to disassemble the code, at get the name, function pointer,
    and figure out the calling convention, and just call it. It might not have a
    CABI...
    Chris Thomasson, Nov 25, 2006
    #4
    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. vrk1981

    Dis assemble C code

    vrk1981, Jul 24, 2003, in forum: C Programming
    Replies:
    1
    Views:
    397
    Binary
    Jul 25, 2003
  2. alphatan['a:lfa:ta2n]

    gdb: insert assemble code but NOT machine?

    alphatan['a:lfa:ta2n], Dec 18, 2003, in forum: C Programming
    Replies:
    2
    Views:
    543
    Grumble
    Dec 18, 2003
  3. lxrocks
    Replies:
    7
    Views:
    335
    Mark McIntyre
    Aug 12, 2004
  4. Roger Nome

    de assemble

    Roger Nome, Jun 3, 2009, in forum: ASP .Net
    Replies:
    0
    Views:
    345
    Roger Nome
    Jun 3, 2009
  5. John Ky
    Replies:
    3
    Views:
    81
    John Ky
    Oct 13, 2006
Loading...

Share This Page