Author |
Message |
ASDF #1 / 9
|
 Cross platform development strategy
Hello, I am writing C programs that need to run on both Windows and Solaris. I want to write code on either one of these platforms and have them compile on both without a lot of work. What is the best strategy to ensure portability of C code? I am searching on web to find this information. What compilers/tools can I use to achieve this portability? Is it possible to generate executables for all platforms while working on the windows platform? Please forgive me if my questions are oblique, I am a newbie. Thanks.
|
Sun, 07 Aug 2005 05:43:39 GMT |
|
 |
Joe Wrigh #2 / 9
|
 Cross platform development strategy
Quote:
> Hello, > I am writing C programs that need to run on both Windows and Solaris. I > want to write code on either one of these platforms and have them > compile on both without a lot of work. What is the best strategy to > ensure portability of C code?
The C Programming Language has been standardized (especially at C89). Use the standard and write C programs according to it. Use compilers that respect this standard on all platforms. Quote: > I am searching on web to find this information.
Perhaps, but not here. This is Usenet, a service of Internet. The 'web' is another thing and very off topic here. Quote: > What compilers/tools can I use to achieve this portability?
There are many choices. Check the C-FAC. I like GCC. Quote: > Is it possible to generate executables for all platforms while working > on the windows platform?
Those are called cross-compilers. Several exist. Go look. Good luck. Quote: > Please forgive me if my questions are oblique, I am a newbie. > Thanks.
--
"Everything should be made as simple as possible, but not simpler." --- Albert Einstein ---
|
Sun, 07 Aug 2005 06:45:28 GMT |
|
 |
CBFalcone #3 / 9
|
 Cross platform development strategy
Quote:
> > I am writing C programs that need to run on both Windows and > > Solaris. I want to write code on either one of these platforms > > and have them compile on both without a lot of work. What is > > the best strategy to ensure portability of C code? > The C Programming Language has been standardized (especially at > C89). Use the standard and write C programs according to it. Use > compilers that respect this standard on all platforms. > > I am searching on web to find this information. > Perhaps, but not here. This is Usenet, a service of Internet. The > 'web' is another thing and very off topic here.
This answer is highly misleading. This is the appropriate newsgroup for the OPs questions; in fact his objectives are the objectives of this group. --
Available for consulting/temporary embedded and systems. <http://cbfalconer.home.att.net> USE worldnet address!
|
Sun, 07 Aug 2005 11:39:26 GMT |
|
 |
Morris Dove #4 / 9
|
 Cross platform development strategy
Quote:
> I am writing C programs that need to run on both Windows and Solaris. I > want to write code on either one of these platforms and have them > compile on both without a lot of work. What is the best strategy to > ensure portability of C code? I am searching on web to find this > information.
Write programs in strict compliance with the C standard. Quote: > What compilers/tools can I use to achieve this portability?
Any compiler that will compile standard C code. I have had good luck lith the Solaris C compiler; and you can use either Microsoft or Gnu C compiler (or any of a number of others) on your Windows platform. I installed the Cygwin package (which provides X-windows) on my Windows box so that I could have a familiar *nix-like development environment and use my favorite editor (nedit) Quote: > Is it possible to generate executables for all platforms while working > on the windows platform?
I suspect, but am not sure, that there is a gcc/solaris cross-compiler that will run on a windows box. You'll need to check in a Gnu newsgroup for this one, unless someone here knows and is willing to help or redirect. Quote: > Please forgive me if my questions are oblique, I am a newbie.
Not a problem. For Unix/POSIX questions you may find
before posting. -- Morris Dovey West Des Moines, Iowa USA C links at http://www.iedu.com/c
|
Sun, 07 Aug 2005 12:16:57 GMT |
|
 |
Simon Bibe #5 / 9
|
 Cross platform development strategy
Quote:
> I am writing C programs that need to run on both Windows and > Solaris. I want to write code on either one of these platforms > and have them compile on both without a lot of work. What is > the best strategy to ensure portability of C code? I am > searching on web to find this information.
The best strategy is to write it in standard-conforming portable C code, which means you don't use any system-provided functions except those specified by the C standard, and you make no assumptions about the operating environment except those specified by the C standard. Read the comp.lang.c FAQ. You can post reasonably-small complete compilable programs here and the regulars of comp.lang.c are very good at picking code apart and making it as portable as possible. Quote: > What compilers/tools can I use to achieve this portability?
Any (hosted) standard C implementation will do. Chances are there are several that you can download for free for your implementation -- this definitely goes for both Solaris and Windows. I think there is a list in the C FAQ (if not there should be) but if not then google away -- off the top of my head, Cygwin (which includes GCC), MinGW32, DJGPP, LCC-Win32, and Borland's Turbo C 2.01 and BCC 5.5 are all free. Quote: > Is it possible to generate executables for all platforms while > working on the windows platform?
Yes. Some compilers, for example gcc, can be built as a cross-compiler that can produce many types of executable. Investigate this in the documentation for your particular C implementation. How to use a particular compiler is off-topic here, and should be taken to the relevant newsgroups or mailing lists for that compiler. -- Simon.
|
Sun, 07 Aug 2005 12:26:46 GMT |
|
 |
Dan P #6 / 9
|
 Cross platform development strategy
Quote: >I am writing C programs that need to run on both Windows and Solaris. I >want to write code on either one of these platforms and have them >compile on both without a lot of work. What is the best strategy to >ensure portability of C code?
Restrict yourself to the features described in K&R2 (if possible) and your code will work without any problems on one platform, after being developed and debugged on the other. Especially if you don't make any assumptions about the endianness of the implementation. If this is not possible, expect to have portability problems. To make the job easier, carefully isolate the non-portable parts. Quote: >What compilers/tools can I use to achieve this portability?
The portability depends on your code, not on the tools. Quote: >Is it possible to generate executables for all platforms while working >on the windows platform?
Probably not, but you really don't want to do that, even if it were possible. Cross-developing is not for the beginners. Dan -- Dan Pop DESY Zeuthen, RZ group
|
Sun, 07 Aug 2005 19:19:14 GMT |
|
 |
Joe Wrigh #7 / 9
|
 Cross platform development strategy
Quote:
> > > I am writing C programs that need to run on both Windows and > > > Solaris. I want to write code on either one of these platforms > > > and have them compile on both without a lot of work. What is > > > the best strategy to ensure portability of C code? > > The C Programming Language has been standardized (especially at > > C89). Use the standard and write C programs according to it. Use > > compilers that respect this standard on all platforms. > > > I am searching on web to find this information. > > Perhaps, but not here. This is Usenet, a service of Internet. The > > 'web' is another thing and very off topic here. > This answer is highly misleading. This is the appropriate > newsgroup for the OPs questions; in fact his objectives are the > objectives of this group.
I fear you misunderstand me my friend. My comment was an attempt to differentiate usenet and the web in the context of the Internet. It was a feeble attempt and I'll think more about it before I comment on the subject again. --
"Everything should be made as simple as possible, but not simpler." --- Albert Einstein ---
|
Mon, 08 Aug 2005 09:03:29 GMT |
|
 |
Derk Gwe #8 / 9
|
 Cross platform development strategy
# Hello, # I am writing C programs that need to run on both Windows and Solaris. I # want to write code on either one of these platforms and have them # compile on both without a lot of work. What is the best strategy to # ensure portability of C code? I am searching on web to find this # information. For my work I split it into system independent code which includes most everything, and system dependent included code. The interface defines what is needed to be done not how it is done. The system dependent code is include files, each system its own file in its own directory named for the system. The .c file includes "quelque-chose.sys" and in the make I can do "cc -Iinclude/$(uname)". The usual method however to use alot of defines and #ifdefs. # What compilers/tools can I use to achieve this portability? Others like to use gnu configure. # Is it possible to generate executables for all platforms while working # on the windows platform? Depends if you have a cross compiler. -- Derk Gwen http://derkgwen.250free.com/html/index.html I love the smell of commerce in the morning.
|
Mon, 08 Aug 2005 10:46:21 GMT |
|
 |
one2001.. #9 / 9
|
 Cross platform development strategy
Quote:
> Hello, > I am writing C programs that need to run on both Windows and Solaris. I > want to write code on either one of these platforms and have them > compile on both without a lot of work. What is the best strategy to > ensure portability of C code? I am searching on web to find this > information. > What compilers/tools can I use to achieve this portability?
You may take a look at cross platfrom C interpreter Ch http://www.softintegration.com Quote: > Is it possible to generate executables for all platforms while working > on the windows platform? > Please forgive me if my questions are oblique, I am a newbie. > Thanks.
|
Tue, 09 Aug 2005 13:36:17 GMT |
|
|