What language for high portability on Windows?

Thread Starter

Roderick Young

Joined Feb 22, 2015
408
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?
 

joeyd999

Joined Jun 6, 2011
5,234
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).
 

cmartinez

Joined Jan 17, 2007
8,218
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?
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
 

vpoko

Joined Jan 5, 2012
267
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
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).
 

cmartinez

Joined Jan 17, 2007
8,218
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).
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++
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
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.
 

Thread Starter

Roderick Young

Joined Feb 22, 2015
408
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.
 

vpoko

Joined Jan 5, 2012
267
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.
 

tjohnson

Joined Dec 23, 2014
611
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.
 

darrough

Joined Jan 18, 2015
86
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.
 
Top