Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Could you compile a program manually?

Could you compile a program manually?

Scheduled Pinned Locked Moved The Lounge
c++question
43 Posts 26 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Brandon X12000

    Is there some way to process a source-to-executable like a computer by hand? If so, could you point to some documents? Could you also compile a device driver source to ".sys" or ".vxd" (depending whether you are developing for a non-NT or NT Windows operating system)?

    Simple Thanks and Regards, Brandon T. H. Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst). Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison

    R Offline
    R Offline
    realJSOP
    wrote on last edited by
    #3

    Oh, I see... You're new here... Take this sage advice in the spirit in which it's given - don't be a dork.

    ".45 ACP - because shooting twice is just silly" - JSOP, 2010
    -----
    You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
    -----
    "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

    C R L I 4 Replies Last reply
    0
    • B Brandon X12000

      Is there some way to process a source-to-executable like a computer by hand? If so, could you point to some documents? Could you also compile a device driver source to ".sys" or ".vxd" (depending whether you are developing for a non-NT or NT Windows operating system)?

      Simple Thanks and Regards, Brandon T. H. Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst). Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison

      A Offline
      A Offline
      AspDotNetDev
      wrote on last edited by
      #4

      You have exceeded your one-silly-question-a-day-in-the-Lounge limit.

      Thou mewling ill-breeding pignut!

      B 1 Reply Last reply
      0
      • B Brandon X12000

        Is there some way to process a source-to-executable like a computer by hand? If so, could you point to some documents? Could you also compile a device driver source to ".sys" or ".vxd" (depending whether you are developing for a non-NT or NT Windows operating system)?

        Simple Thanks and Regards, Brandon T. H. Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst). Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison

        B Offline
        B Offline
        Brady Kelly
        wrote on last edited by
        #5

        Brandon T. H. wrote:

        Is there some way to process a source-to-executable like a computer by hand?

        Only in a Chinese Room.

        B 1 Reply Last reply
        0
        • B Brandon X12000

          Is there some way to process a source-to-executable like a computer by hand? If so, could you point to some documents? Could you also compile a device driver source to ".sys" or ".vxd" (depending whether you are developing for a non-NT or NT Windows operating system)?

          Simple Thanks and Regards, Brandon T. H. Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst). Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison

          P Offline
          P Offline
          Paul Conrad
          wrote on last edited by
          #6

          You could, but why?

          "Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus

          B 1 Reply Last reply
          0
          • B Brandon X12000

            Is there some way to process a source-to-executable like a computer by hand? If so, could you point to some documents? Could you also compile a device driver source to ".sys" or ".vxd" (depending whether you are developing for a non-NT or NT Windows operating system)?

            Simple Thanks and Regards, Brandon T. H. Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst). Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison

            C Offline
            C Offline
            c2423
            wrote on last edited by
            #7

            No reason you couldn't compile something by hand, but it wouldn't be a good use of your time. If you really must write binary code and see the end product you'd be much better off writing a C-like compiler and writing relatively high level code and compiling it automatically. Writing this stuff in C as opposed to machine code or binary would be orders of magnitude faster. Judging by a quick look at your profile, along with your previous similar question, it looks like you're trying to write your own OS of sorts - you might like to take a look at Minix[^] which is a simplified Unix OS - I had to choose part of it to rewrite for my degree, so it's not too hard to take a look at and work out how things like drivers work. As a side note, does anybody else ever feel like they're channelling the MS paperclip? "It looks like you're trying to write a letter", "It looks like you're trying to write an Operating System" Hope this helps, Chris

            _ 1 Reply Last reply
            0
            • R realJSOP

              Oh, I see... You're new here... Take this sage advice in the spirit in which it's given - don't be a dork.

              ".45 ACP - because shooting twice is just silly" - JSOP, 2010
              -----
              You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
              -----
              "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

              C Offline
              C Offline
              Colin Mullikin
              wrote on last edited by
              #8

              John Simmons / outlaw programmer wrote:

              Take this sage advice in the spirit in which it's given - don't be a dork.

              :thumbsup: :laugh:

              The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin

              1 Reply Last reply
              0
              • B Brandon X12000

                Is there some way to process a source-to-executable like a computer by hand? If so, could you point to some documents? Could you also compile a device driver source to ".sys" or ".vxd" (depending whether you are developing for a non-NT or NT Windows operating system)?

                Simple Thanks and Regards, Brandon T. H. Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst). Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #9

                Brandon T. H. wrote:

                Is there some way to process a source-to-executable like a computer by hand?

                Yes (well duh, computers can't compute anything that humans can't, they're just faster at it), and it's not even that hard (just time-consuming). Converting whatever-language source to assembly? Piece of cake. Assembling by hand? Conceptually simple, only requires looking things up in a table. Putting it in the right executable format? Ok that one is a little tricky to get right, but also not that hard.

                Brandon T. H. wrote:

                If so, could you point to some documents?

                Sure. For x86+windows: Intel manuals[^] ModRM encoding (on sandpile.org)[^] PE 101[^]

                Brandon T. H. wrote:

                Could you also compile a device driver source to ".sys" or ".vxd"

                I see no reason why this should be impossible.

                S B 2 Replies Last reply
                0
                • B Brandon X12000

                  Is there some way to process a source-to-executable like a computer by hand? If so, could you point to some documents? Could you also compile a device driver source to ".sys" or ".vxd" (depending whether you are developing for a non-NT or NT Windows operating system)?

                  Simple Thanks and Regards, Brandon T. H. Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst). Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison

                  L Offline
                  L Offline
                  lewax00
                  wrote on last edited by
                  #10

                  Here's a more generic solution: Everything a computer does is manipulating numbers through a handful of basic operations (i.e. arithmetic, like addition/subtraction, and logic, like and, or, etc.), and move them around in memory. If you can manage those things then you can do anything a computer can do, it will just be much slower if you do. From a more mathematical stand point, any modern computer can be modeled as a Turing Machine[^], and you should be able to do everything a Turing machine can (of course, you won't have access to an infinite tape but this task is not infinite so you should be fine there). So to sum it up: if your computer can, you can too.

                  1 Reply Last reply
                  0
                  • B Brandon X12000

                    Is there some way to process a source-to-executable like a computer by hand? If so, could you point to some documents? Could you also compile a device driver source to ".sys" or ".vxd" (depending whether you are developing for a non-NT or NT Windows operating system)?

                    Simple Thanks and Regards, Brandon T. H. Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst). Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison

                    R Offline
                    R Offline
                    Roger Wright
                    wrote on last edited by
                    #11

                    It can be done, but it will take some time. Here's a manual[^].

                    Will Rogers never met me.

                    M 1 Reply Last reply
                    0
                    • C c2423

                      No reason you couldn't compile something by hand, but it wouldn't be a good use of your time. If you really must write binary code and see the end product you'd be much better off writing a C-like compiler and writing relatively high level code and compiling it automatically. Writing this stuff in C as opposed to machine code or binary would be orders of magnitude faster. Judging by a quick look at your profile, along with your previous similar question, it looks like you're trying to write your own OS of sorts - you might like to take a look at Minix[^] which is a simplified Unix OS - I had to choose part of it to rewrite for my degree, so it's not too hard to take a look at and work out how things like drivers work. As a side note, does anybody else ever feel like they're channelling the MS paperclip? "It looks like you're trying to write a letter", "It looks like you're trying to write an Operating System" Hope this helps, Chris

                      _ Offline
                      _ Offline
                      _beauw_
                      wrote on last edited by
                      #12

                      When I look at some of the pie-in-the-sky news items about things like automatic parallelization, I get the sense that we are alarmingly close to the day when an animated character in an IDE says things like "it looks like you're trying to write an OS." I think this kind of thing is an example of what I call the "Hero Anti-Pattern," in which one supposedly brilliant developer abstracts everything (garbage collection, parallelization, "plumbing" code...) away from the rest of us. My gut tells me that self-proclaimed geniuses toiling away in a vacuum will probably never really keep the rest of us from having to worry about whatever it is they're trying to fix. Instead, what results is that these people get to shape the future of development, and rake in the concomitant glory and cash, while the rest of us just end up doing the same tasks (albeit in Hero-ized form).

                      C J S 3 Replies Last reply
                      0
                      • B Brandon X12000

                        Is there some way to process a source-to-executable like a computer by hand? If so, could you point to some documents? Could you also compile a device driver source to ".sys" or ".vxd" (depending whether you are developing for a non-NT or NT Windows operating system)?

                        Simple Thanks and Regards, Brandon T. H. Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst). Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison

                        _ Offline
                        _ Offline
                        _beauw_
                        wrote on last edited by
                        #13

                        I've done a lot of hand-assembly, i.e. translating assembly language into machine language (raw numbers). This ends up being very mechanical. There's not much thought involved. As far as hand-compilation of higher-level language code goes, that's somewhat mechanical, too, and most people with CS degrees will have done some of this as a part of their education. One of my articles[^] relies pretty heavily on hand-compiled C code, although I must also note that I artificially constrained my use of C to certain features, to make this chore easier.

                        1 Reply Last reply
                        0
                        • R realJSOP

                          Oh, I see... You're new here... Take this sage advice in the spirit in which it's given - don't be a dork.

                          ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                          -----
                          You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                          -----
                          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                          R Offline
                          R Offline
                          RedDk
                          wrote on last edited by
                          #14

                          That's a potentially devastating thing to say to a four year old

                          L 1 Reply Last reply
                          0
                          • B Brandon X12000

                            Is there some way to process a source-to-executable like a computer by hand? If so, could you point to some documents? Could you also compile a device driver source to ".sys" or ".vxd" (depending whether you are developing for a non-NT or NT Windows operating system)?

                            Simple Thanks and Regards, Brandon T. H. Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst). Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison

                            L Offline
                            L Offline
                            Lost User
                            wrote on last edited by
                            #15

                            If you're interested in c++ you could download and build the clang compiler (or gcc if you're brave) then step through it as it compiles and links your program. Good luck.

                            1 Reply Last reply
                            0
                            • _ _beauw_

                              When I look at some of the pie-in-the-sky news items about things like automatic parallelization, I get the sense that we are alarmingly close to the day when an animated character in an IDE says things like "it looks like you're trying to write an OS." I think this kind of thing is an example of what I call the "Hero Anti-Pattern," in which one supposedly brilliant developer abstracts everything (garbage collection, parallelization, "plumbing" code...) away from the rest of us. My gut tells me that self-proclaimed geniuses toiling away in a vacuum will probably never really keep the rest of us from having to worry about whatever it is they're trying to fix. Instead, what results is that these people get to shape the future of development, and rake in the concomitant glory and cash, while the rest of us just end up doing the same tasks (albeit in Hero-ized form).

                              C Offline
                              C Offline
                              c2423
                              wrote on last edited by
                              #16

                              The way I look at it, they need to be kept busy doing something while the rest of us make stuff that actually benefits people.

                              1 Reply Last reply
                              0
                              • R realJSOP

                                Oh, I see... You're new here... Take this sage advice in the spirit in which it's given - don't be a dork.

                                ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                                -----
                                You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                                -----
                                "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                                L Offline
                                L Offline
                                Lost User
                                wrote on last edited by
                                #17

                                He's not that new; and check out his signature. apologies if Brandon T.H is a girl.

                                One of these days I'm going to think of a really clever signature.

                                1 Reply Last reply
                                0
                                • L Lost User

                                  Brandon T. H. wrote:

                                  Is there some way to process a source-to-executable like a computer by hand?

                                  Yes (well duh, computers can't compute anything that humans can't, they're just faster at it), and it's not even that hard (just time-consuming). Converting whatever-language source to assembly? Piece of cake. Assembling by hand? Conceptually simple, only requires looking things up in a table. Putting it in the right executable format? Ok that one is a little tricky to get right, but also not that hard.

                                  Brandon T. H. wrote:

                                  If so, could you point to some documents?

                                  Sure. For x86+windows: Intel manuals[^] ModRM encoding (on sandpile.org)[^] PE 101[^]

                                  Brandon T. H. wrote:

                                  Could you also compile a device driver source to ".sys" or ".vxd"

                                  I see no reason why this should be impossible.

                                  S Offline
                                  S Offline
                                  Sentenryu
                                  wrote on last edited by
                                  #18

                                  remember me to get you a 5 when the vote system gets back online, you deserve it.

                                  I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)

                                  B 1 Reply Last reply
                                  0
                                  • R RedDk

                                    That's a potentially devastating thing to say to a four year old

                                    L Offline
                                    L Offline
                                    loctrice
                                    wrote on last edited by
                                    #19

                                    :laugh:

                                    If it moves, compile it

                                    1 Reply Last reply
                                    0
                                    • L Lost User

                                      Yes, you just need to convert each line of source code into its object code equivalent. Once you have done that you build it into a binary file with a hex editor and, hey presto, Robert's your mother's brother.

                                      One of these days I'm going to think of a really clever signature.

                                      L Offline
                                      L Offline
                                      loctrice
                                      wrote on last edited by
                                      #20

                                      Richard MacCutchan wrote:

                                      hey presto, Robert's your mother's brother.

                                      I punched the wife when I read that. I will never forget it.

                                      If it moves, compile it

                                      1 Reply Last reply
                                      0
                                      • _ _beauw_

                                        When I look at some of the pie-in-the-sky news items about things like automatic parallelization, I get the sense that we are alarmingly close to the day when an animated character in an IDE says things like "it looks like you're trying to write an OS." I think this kind of thing is an example of what I call the "Hero Anti-Pattern," in which one supposedly brilliant developer abstracts everything (garbage collection, parallelization, "plumbing" code...) away from the rest of us. My gut tells me that self-proclaimed geniuses toiling away in a vacuum will probably never really keep the rest of us from having to worry about whatever it is they're trying to fix. Instead, what results is that these people get to shape the future of development, and rake in the concomitant glory and cash, while the rest of us just end up doing the same tasks (albeit in Hero-ized form).

                                        J Offline
                                        J Offline
                                        John Atten
                                        wrote on last edited by
                                        #21

                                        Aren't we already almost there? VS: "File/New/ASP.NET MVC Project" or "File/New/Entity Model." Eclipse: "File/New/Java Package" Most modern IDE's abstract away so much boiler plate code that we have acheived almost the equivalent of Clippy already. Newcomers, such as myself, begin to believe that that's all there is to it. The "run" button, which in reality "builds" such projects then executes the build result, optionally stepping through in an integrated debugger, removes a whole lot behind-the-scenes operations. While all of these are great for productivity, and in many cases represent the ultimate goal of code re-use, they also deprive (for a time, anyway) us of the need to learn how these hidden parts of the process work.

                                        1 Reply Last reply
                                        0
                                        • R realJSOP

                                          Oh, I see... You're new here... Take this sage advice in the spirit in which it's given - don't be a dork.

                                          ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                                          -----
                                          You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                                          -----
                                          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

                                          I Offline
                                          I Offline
                                          Isfeasachme
                                          wrote on last edited by
                                          #22

                                          Sage advice... Pssh. Ya junior code snot. I'm glad I'm not the only assembler dork out there. This is the sort of question asked by people who end up designing the compilers you all use.

                                          B 2 Replies Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups