writing platform-portable code in vc++

  • Thread starter Thread starter Abubakar
  • Start date Start date
A

Abubakar

Hi,
we are finding out ways in which we could develop libraries that could be
written in c++ in a way that we can use them in windows, linux, and mac os.
We want to write portable code, so that it could be build on mac os, linux,
and windows. The code would involve lots of multi-threading and
network/socket programming. Since I have read that vc++ 2k5 supports a lot
of standard c++ stuff, can it help me to acheive what I want or I will have
to use something like gnu c++ compiler like gcc I guess. We wanna start with
writing application on windows os, and than when its completed, port the
code to run on linux and than on mac os. Need a lot of guidance. Also please
mention any books of c++ that would allow us to do socket and
multi-threading programming for multiple platforms. Thanks.

Abubakar.
 
How portable your code is depends on how machine independent the application
will be. This of course depends on the purpose and goals of the application.

For example, if your application is very graphic intensive, then you will
want to give great consideration in separating the graphic code from the
logic code. Typically, only logic code tends to port well.

As for VS.NET. If you stick to the C++ standard VS C++.NET supports it. But
be careful about getting persuaded by conveniences that this particular
compiler and/or development environment has to offer. For example, you might
be tempted to code in C# instead of C++, since it does have some nice
syntactical features. But know that C# only runs on the Windows platform.
This applies to almost anything in the .NET Framework classes.

That being said, you could still potentially use VS.NET and all it has to
offer, just realize that every feature you use that in not part of the C++
standard will likely need to be re-written or emulated on other platforms
when you port...

[==P==]
 
You can run C# code without recompile it in multiple platforms using Mono.
In fact, you could run any .net assembly using mono if you only use classes
supported by Mono.



--
Un saludo
Rodrigo Corral González [MVP]

FAQ de microsoft.public.es.vc++
http://rcorral.mvps.org
 
I think that Qt4 has sockets and thread support. The source code compiles to
Mac, Windows and Linux.
 
Thanks for the reply.
I dont want to use C#. The only option for this project is C++.

Ab.

Peter Oliphant said:
How portable your code is depends on how machine independent the application
will be. This of course depends on the purpose and goals of the application.

For example, if your application is very graphic intensive, then you will
want to give great consideration in separating the graphic code from the
logic code. Typically, only logic code tends to port well.

As for VS.NET. If you stick to the C++ standard VS C++.NET supports it. But
be careful about getting persuaded by conveniences that this particular
compiler and/or development environment has to offer. For example, you might
be tempted to code in C# instead of C++, since it does have some nice
syntactical features. But know that C# only runs on the Windows platform.
This applies to almost anything in the .NET Framework classes.

That being said, you could still potentially use VS.NET and all it has to
offer, just realize that every feature you use that in not part of the C++
standard will likely need to be re-written or emulated on other platforms
when you port...

[==P==]

Abubakar said:
Hi,
we are finding out ways in which we could develop libraries that could be
written in c++ in a way that we can use them in windows, linux, and mac
os.
We want to write portable code, so that it could be build on mac os,
linux,
and windows. The code would involve lots of multi-threading and
network/socket programming. Since I have read that vc++ 2k5 supports a lot
of standard c++ stuff, can it help me to acheive what I want or I will
have
to use something like gnu c++ compiler like gcc I guess. We wanna start
with
writing application on windows os, and than when its completed, port the
code to run on linux and than on mac os. Need a lot of guidance. Also
please
mention any books of c++ that would allow us to do socket and
multi-threading programming for multiple platforms. Thanks.

Abubakar.
 
The situation is this that our client wants that there should be three diff
downloads, each for windows, linux and mac os. The client has forced us to
use the C++ cuz he doesnt wasnt the application to use *anything* extra that
would have to be downloaded by the people who would use this application. So
we cant use C# cuz that would require mono or .net redistributeables to be
downloaded where ever the application needs to be run (although we used C#
for the prototype).
I think that Qt4 has sockets and thread support. The source code compiles to
Mac, Windows and Linux.

If I use Qt4 and build application using it, will that require any extra
thing to be downloaded and installed?

Ab.
 
Abubakar.. As far as I know it compiles to native code in each platform but
you can go to the trolltech and download the whtie paper and the free version
of QT4.

 
Back
Top