What language for high portability on Windows?

Discussion in 'Programmer's Corner' started by Roderick Young, Apr 21, 2015.

  1. Roderick Young

    Thread Starter Member

    Feb 22, 2015
    408
    168
    Hi, I've come across some open source code, but it's written for (I think) RadStudio C++. If I were to adapt it, what would be the best compiler to use so that others could easily recompile and adapt my version? If this was on Linux, the choice would clearly be gcc, but in this case, I'm not so sure. I want to use a compiler that anyone can get free, and gcc will create Windows applications, but I also know that the end application will probably never run on Linux, because it interfaces with DLL's made for Windows, and performance would be unacceptable if there were any adaptation layer inserted. I was thinking maybe Visual Studio Express 2010 might be best? Opinions?
     
  2. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,677
    2,730
    I am not a Windows user, but this is what I know:

    High level C/C++ code is theoretically portable between different platforms and compilers. Code that utilizes standard libraries is also generally portable.

    The problem comes when compiling against proprietary and/or non-standard libraries. Visual Studio, IIRC, uses the MFC (Microsoft Foundation Class) libraries for window/application management. These may not be compatible with the libraries used to build the app, both from a naming convention and implementation stand point.

    Since the code is open source, you may be able to build against the original libraries (check to see if they are available as source code) or link against them if they are available as binary -- and include the .dll file(s) for the library(ies).
     
  3. cmartinez

    AAC Fanatic!

    Jan 17, 2007
    3,572
    2,536
    Yup... I was going to recommend VS Express... but the 2013 version of it... It won't matter which language you choose, either VB, C++ or the other languages that it supports... the compiler is highly efficient and the code in the end will have the same size and performance.
    I've been using VB all these years and had a little bit of a hard time adapting to the .NET architecture, but it was worth it.
    EDIT: check their page out: https://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx
     
  4. vpoko

    Member

    Jan 5, 2012
    258
    47
    I don't believe the OP has a choice of language since he's using an existing code base. As far as VS-supported languages, keep in mind that the Visual C++ compiler can compile unmanaged code (that is, code that targets the CPU architecture directly and not the .NET runtime VM). C#, VB.NET, etc, only produce managed code. There isn't necessarily a performance hit with managed code, but there could be in some cases, and there are of course a lot of other differences (ease of disassembling, available libraries, etc).
     
  5. cmartinez

    AAC Fanatic!

    Jan 17, 2007
    3,572
    2,536
    You're right... his original requirements stated that he wanted to adapt C++ ... either way, I still think VS Express 2013 is an option... It's been a very, very long time since I've programmed anything in C++
     
  6. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,534
    2,369
    A couple of years ago I picked a full version of VS 2008 off ebay for <$100, the CD was marked 'Not For Resale' but it is the full version.
    There maybe still deals out there?
    Max.
     
  7. Roderick Young

    Thread Starter Member

    Feb 22, 2015
    408
    168
    While it's true that there's an existing code base, I don't care about compiling it with minimal changes. I'm quite willing to do a complete rewrite of graphics and human interface routines, just preserving the core computation engine. I even contemplated rewriting in plain C, as I'm more comfortable with that, but decided it would be better to keep it in c++.

    I suppose I could get some better version of Visual Studio (we used Enterprise Edition at work), but I don't want to discourage future coders by requiring them to spend money to recompile.
     
  8. vpoko

    Member

    Jan 5, 2012
    258
    47
    In that case I'd recommend C# using Visual Studio Express as your IDE, which is free.

    Java using Eclipse could also work (and has the benefit of being cross-platform), though I'm honestly not sure how interoperability between the Java UI and the native-code computation engine would be handled. If you could compile the computation engine as a text-based program that takes its input from the command line, it would be very easy, but if you needed to, say, call Windows DLL functions from Java and marshall objects between them, I'm sure it could be done, but I'm not sure how easy or difficult it is.

    Finally, if you're familiar with MFC (or brave enough to learn), you could go the C++ route using Visual Studio Express. There's also something called ATL (Active Template Library) for C++ which is simpler than MFC but more complicated than C#.

    I guess what it comes down to is your experience developing UI's. If you have some in X, use X, and if you don't, use C#, because the other options are significantly more difficult.
     
    cmartinez likes this.
  9. tjohnson

    Active Member

    Dec 23, 2014
    614
    121
    Speaking of Visual Studio, has anyone had success installing VS 2010 SP1 on Windows 8.1? When I tried it several months ago, I couldn't get it to work.
     
  10. Papabravo

    Expert

    Feb 24, 2006
    10,140
    1,790
    Python! So saieth the BDFL! At least I think that is what he would say.
     
    tjohnson likes this.
  11. darrough

    Member

    Jan 18, 2015
    86
    19
    If the application is staying on Windows then go for C#/Visual Studio Express.

    If you want a GUI that is portable across multiple operating systems use Java with Swing, SWT or AWT. But be warned, these windowing templates are hard to learn. AWT is probably the easiest, but it is also the least features.
     
    cmartinez likes this.
  12. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,388
    497
Loading...