assembly code

This is a discussion on assembly code within the Tech Board forums, part of the Community Boards category; I just want to ask that can i execute assembly codes in code::block directly. I mean with out using _asm() ...

  1. #1
    Infant of C
    Join Date
    May 2010
    Location
    Karachi, Pakistan
    Posts
    118

    assembly code

    I just want to ask that can i execute assembly codes in code::block directly. I mean with out using _asm() function e.t.c.

    any one have knowledge about it? and if so how to do this?

  2. #2
    Registered User
    Join Date
    Jun 2011
    Posts
    2,244
    Code::Blocks is simply an IDE. Which compiler are you using with it?

  3. #3
    Infant of C
    Join Date
    May 2010
    Location
    Karachi, Pakistan
    Posts
    118
    gnu gcc

  4. #4
    Infant of C
    Join Date
    May 2010
    Location
    Karachi, Pakistan
    Posts
    118
    can I have an assembly compiler attached with it?

  5. #5
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    assembly compiler
    Don't you mean assembler?

    In codeblocks, there is an option to make a makefile project.
    Create the makefile manually, and open the assembly file in c::B .

    Still, there won't be any benefit in that. A good text editor with an attached terminal works better in this case...Try Kate (*nix) or Notepad++ (win).
    //btw..I don't know if Notepad++ has a terminal plugin.
    Last edited by manasij7479; 07-19-2011 at 09:02 AM.
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  6. #6
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,444
    I'm not too familiar with the Windows port of GCC, but I'm sure it's near identical to the Linux one, at least for the "main" features. The compiler can recognize what type of file it has by the extension. A .c extension is for C source code. A .s file is for assembly. The Windows equivalent of the man page (i.e. documentation) should give you more specifics. AFAIK, the compiler works on translation units, which is basically a .c file after all the preprocessing (including the #inlucde files, replacing macros/constants, handling #if's, etc). With that being the case, you can't have a single file with mixed C code and assembly without using the _asm() function. You can however make a file that just contains assembly code, and give it a .s extension. GCC should be able to recognize it as an assembly file and only run the assembler on that file instead of the full C compiler. You should end up with a corresponding .o file that you can link into your final project.

  7. #7
    Infant of C
    Join Date
    May 2010
    Location
    Karachi, Pakistan
    Posts
    118
    Don't you mean assembler?
    Yes i meant assembler.

    the file extension for assembly in windows is .asm . Yes as you say the Ide is able to recognize it as an assembly source code. but the problem is that the compiler is not able to find the required libraries to make an .obj or as you said .o file neither an .exe file.

  8. #8
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,444
    Finding libraries has nothing to do with the compiling or assembly. It's part of the linking phase of the build process. You need to change your project settings to link the libraries you're using.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Generate Assembly code and Binary code also
    By Hannibal2010 in forum C Programming
    Replies: 16
    Last Post: 07-07-2011, 05:43 AM
  2. Convert assembly>machine code, machine code>assembly
    By wenxinleong in forum C Programming
    Replies: 12
    Last Post: 06-23-2011, 10:42 PM
  3. Converting C code to DLX assembly code
    By xyz3 in forum C Programming
    Replies: 2
    Last Post: 05-17-2010, 02:01 PM
  4. GCC option to get assembly code AND C code
    By AntoineC in forum C Programming
    Replies: 2
    Last Post: 04-29-2010, 09:04 AM
  5. assembly code for release code?
    By George2 in forum Windows Programming
    Replies: 4
    Last Post: 07-09-2008, 11:17 AM

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