Thread: Assembly inline

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0

    Assembly inline


    HI
    i have problems with inline assembly syntax in C (not C++);
    for example code type like this:

    _asm {
    mov ...,...
    lea ...,...
    etc....
    }

    doesn't work...becouse compiler doesn't recognize *__asm* as keyword, then says that mov isn't declared, ecc.....can anyone help me??
    thanks in advance !
  2. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,255
    Rep Power
    2222
    Tell us what compiler you're using. Then someone experienced with that compiler could help you.

    A short compilable program that contains that code might also be helpful to that person who has the same compiler as you.

    In the meantime, have you considered playing with the number of underscores preceding the asm keyword? I recall many years ago seeing it without any underscores. Consulting your IDE's help file about inline assembly might also help.
    Last edited by dwise1_aol; August 20th, 2013 at 11:39 AM.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0
    Originally Posted by dwise1_aol
    I recall many years ago seeing it without any underscores. Consulting your IDE's help file about inline assembly might also help.
    thanks, done but problems remains the same...
    i'm using GNU GCC, and I am trying to select from compiler's setting (in codeBlock's IDE) the Visual C++ (probably with this _asm syntax will works), but it can't find the correct path to VC.exe...
    can I use another compiler??
    thanks for your help!
  6. #4
  7. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,255
    Rep Power
    2222
    STFW! ("Search The Web!")

    I looked up inline assembly in Wikipedia and got the article at . At the bottom of that article is a link to GCC-Inline-Assembly-HOWTO (this is a link, BTW). I'm such I could just as easily and more directly have found it through Google.

    What I'm seeing is using parentheses instead of braces as you had tried, basically a function call that you pass a string of assembly source to. Now, I'm sure that I have seen your notation before, so I guess it's one of those non-standard features that everybody implements differently. But at least that HOWTO should help point you in the right direction.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0
    Hi and thanks,
    in fact:
    "GCC, the GNU C Compiler for Linux, uses AT&T/UNIX assembly syntax".
    I use intel syntax then I need a different compiler...
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    159
    Rep Power
    19
    but it can't find the correct path to VC.exe...
    Why would you search for VC.exe? Isn't the compiler called cl.exe?

    can I use another compiler??
    Yes, but you need to know the proper names and locations for the associated tools.

    Why don't you just use Visual C++?

    Jim
  12. #7
  13. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,255
    Rep Power
    2222
    OK. So then you're going to do a search for compilers that support intel syntax.
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0
    ok, thanks...
    i'm using codeBlocks, but now I'll try Visual studio express 2012...

IMN logo majestic logo threadwatch logo seochat tools logo