Is there a way to compile assembly and C together?

This is a discussion on Is there a way to compile assembly and C together? within the C Programming forums, part of the General Programming Boards category; I am using Visual C++ 6.0 in Windows XP. Is there a way that I can code assembly with C ...

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    98

    Is there a way to compile assembly and C together?

    I am using Visual C++ 6.0 in Windows XP. Is there a way that I can code assembly with C and compile it?
    Thanks

  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,074
    Inline Assembler from MSDN

    It says C++, but it you read it says it works for both C and C++. Also, Google is Your Friend... Search the Web... Read the ' Manual... and all that junk.
    Last edited by Ken Fitlike; 10-04-2006 at 05:38 AM. Reason: Please do NOT attempt to bypass the profanity filter; it's there for a very good reason.
    Sent from my iPadŽ

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    98
    Thanks

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    98
    Every time that I use __asm{} in C, it gives an access violation error when I use the int command(interrupt). And thats if it doesn't freeze first.
    Please help!

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Post code?

    Note that modern operating systems don't let you freely do interrupts and will kill your app if you attempt to.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #6
    Registered User
    Join Date
    Sep 2006
    Posts
    98
    >Post code?
    If I just type
    Code:
    __asm
    {
    }
    and if I click on the __asm statement I freezes

    Quote Originally Posted by CornedBee
    Note that modern operating systems don't let you freely do interrupts and will kill your app if you attempt to.
    Why would it do that? BTW, I can use Notepad to write assembly and it works.

  7. #7
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Code:
    and if I click on the __asm statement I freezes
    Wow, your compiler freezes when you click on some text!
    What did you mean by that sentence?
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  8. #8
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,231
    Wow, your compiler freezes when you click on some text!
    Maybe code editor, not the compiler.

    Why would it do that?
    Applications don't have such low level accesses in modern OSes.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  9. #9
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,659
    > when I use the int command(interrupt).
    VC6 is a 32 bit compiler, running on a 32-bit OS.

    16-bit real-mode interrupts are just a really bad idea.

    Now, which int() are you trying to call, so we can tell you which is the most likely win32 API call to use in it's place.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21