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. I just spent 10 years making this work.

I just spent 10 years making this work.

Scheduled Pinned Locked Moved The Lounge
c++linux
22 Posts 12 Posters 1 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.
  • M Matthew Faithfull

    As far as I can remember it's 10 years to the week, certainly 10 years to the nearest month since I started building the worlds simplest C++ program.

    int main()
    {
    return 42;
    }

    and finally today for the first time it builds, runs and returns 42, on 32bit Windows and 64bit Linux without linking to any system libraries on either. I finally have proof that a universal C++ runtime is possible. :-D ^ 42 .I am quite literally tired and emotional. :zzz:

    "The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)

    D Offline
    D Offline
    Dholakiya Ankit
    wrote on last edited by
    #12

    congrates :)

    1 Reply Last reply
    0
    • M Matthew Faithfull

      Thanks, I know about Ruben and others working hard on MinGW64. The MinGW I'm using is the one that comes with the latest CodeBlocks, 12.11. It has the MinGW64 CRT but uses T Dragon's GCC build. I think the compiler is OK but the MinGW linker has frankly always been dodgy. I don't know why it should be so hard to get a PE linker to work? LLVM/Clang's PE linker is also broken and even Microsoft's VC linker has always been flaky. Fortunately and completely out of character Intel who normally can't write software to save their lives seem to have got it right. The ICL linker xilink is OK.

      "The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)

      B Offline
      B Offline
      Brisingr Aerowing
      wrote on last edited by
      #13

      The latest versions seem to be working somewhat well, I have seen no real flakiness. I have seen it spaz out once, but that was because of a corrupt import library from the MinGW-w64 CRT.

      brisingr_aerowing@Gryphon-PC $ rake in_the_dough Raking in the dough brisingr_aerowing@Gryphon-PC $ make lots_of_money Making lots_of_money

      M 1 Reply Last reply
      0
      • B Brisingr Aerowing

        The latest versions seem to be working somewhat well, I have seen no real flakiness. I have seen it spaz out once, but that was because of a corrupt import library from the MinGW-w64 CRT.

        brisingr_aerowing@Gryphon-PC $ rake in_the_dough Raking in the dough brisingr_aerowing@Gryphon-PC $ make lots_of_money Making lots_of_money

        M Offline
        M Offline
        Matthew Faithfull
        wrote on last edited by
        #14

        In general it works fine and I have to say my test runs alright once it has paused for 40 seconds to load the 144MB Dll. I think the issue is building a Dll that includes static libraries which has generally been considered evil with MinGW in the past. I've even seen statements claiming it can't be done which is silly. I can't complain too much though I am pushing the boat out a bit far, not only building a Dll with static libraries linked in but using -nostdlib, my own replacement for libsupc++ and still linking to the MinGW libgcc for the rest of the dependencies. I had to write my own spec file to make it do that and I'm not surprised if it has a bit of a strop, hardly a 'normal' test case. :) All this craziness is mainly to provide a stepping stone between Windows and Linux in terms of development. I start with the code working on 32bit Windows and then change one thing at a time, Compiler to 32bit MinGW-GCC. OK, Build for x64 under VS2012 (that's still not quite working) and then having got both 64bit and GCC support I make the jump to 64bit Linux GCC. It's worked a treat and reduced what I thought would be 3 months work to 3 weeks.

        "The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)

        1 Reply Last reply
        0
        • M Matthew Faithfull

          What? Are you serious? Do you know how much extra work that would be? :laugh: At the moment printf works on Windows but is stubbed on Linux. I have the necessary code for the formatting and IO but I need to review it for commonality with the Windows code and work out exactly where to put the formatter especially if it can be common. I'll come back to it in a few weeks and get printf to work. Then there will be "Hello World!".

          "The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)

          J Offline
          J Offline
          JackDingler
          wrote on last edited by
          #15

          How about simplifying the effort and use puts()?

          M C 2 Replies Last reply
          0
          • M Matthew Faithfull

            As far as I can remember it's 10 years to the week, certainly 10 years to the nearest month since I started building the worlds simplest C++ program.

            int main()
            {
            return 42;
            }

            and finally today for the first time it builds, runs and returns 42, on 32bit Windows and 64bit Linux without linking to any system libraries on either. I finally have proof that a universal C++ runtime is possible. :-D ^ 42 .I am quite literally tired and emotional. :zzz:

            "The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)

            S Offline
            S Offline
            simpelman
            wrote on last edited by
            #16

            D. Adams would have been proud of you

            1 Reply Last reply
            0
            • M Matthew Faithfull

              Thank you. I'll be taking the weekend off before the new job begins Monday.

              "The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)

              G Offline
              G Offline
              greldak
              wrote on last edited by
              #17

              So Long The dover sole and brown trout was nice enough but what am I supposed to do with all the cod, haddock and pike?

              1 Reply Last reply
              0
              • M Matthew Faithfull

                As far as I can remember it's 10 years to the week, certainly 10 years to the nearest month since I started building the worlds simplest C++ program.

                int main()
                {
                return 42;
                }

                and finally today for the first time it builds, runs and returns 42, on 32bit Windows and 64bit Linux without linking to any system libraries on either. I finally have proof that a universal C++ runtime is possible. :-D ^ 42 .I am quite literally tired and emotional. :zzz:

                "The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)

                A Offline
                A Offline
                AnotherKen
                wrote on last edited by
                #18

                On the plus side, you won't have to spend decades debugging or optimizing that code :)

                M 1 Reply Last reply
                0
                • J JackDingler

                  How about simplifying the effort and use puts()?

                  M Offline
                  M Offline
                  Matthew Faithfull
                  wrote on last edited by
                  #19

                  I do actually have puts working on Windows and Linux so yes I could do that. The sample apps I've written require printf in a few places although if you use printf with just a format string, no parameters, GCC 'magically' turns it into a call to puts anyway.

                  "The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)

                  J 1 Reply Last reply
                  0
                  • A AnotherKen

                    On the plus side, you won't have to spend decades debugging or optimizing that code :)

                    M Offline
                    M Offline
                    Matthew Faithfull
                    wrote on last edited by
                    #20

                    :laugh:

                    "The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)

                    1 Reply Last reply
                    0
                    • M Matthew Faithfull

                      I do actually have puts working on Windows and Linux so yes I could do that. The sample apps I've written require printf in a few places although if you use printf with just a format string, no parameters, GCC 'magically' turns it into a call to puts anyway.

                      "The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)

                      J Offline
                      J Offline
                      JackDingler
                      wrote on last edited by
                      #21

                      Though it annoys me that compilers are smart enough to replace what you tell them to do, with what you meant to tell them to do (even if you didn't know you meant to do it), that is a good safety feature. printf's can be very unsafe....

                      1 Reply Last reply
                      0
                      • J JackDingler

                        How about simplifying the effort and use puts()?

                        C Offline
                        C Offline
                        Chad3F
                        wrote on last edited by
                        #22

                        puts()? That has waaaaay too much overhead! ;) Try:

                        write(STDOUT_FILENO, "Hello World!\n", 13);

                        or..

                        write(STDOUT_FILENO, "Hello 42!\n", 10);

                        1 Reply 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