Transferring a C program from a Mac to an IBM clone
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Transferring a C program from a Mac to an IBM clone
Greetings folks,
Maybe a dumb question but can you transfer a C program from an Intel based Mac to an IBM clone and expect it to work? I'm assuming there is communication to/from USB involved.
Would it need to be compiled on the IBM clone or would it just work?
Greetings folks,
Maybe a dumb question but can you transfer a C program from an Intel based Mac to an IBM clone and expect it to work? I'm assuming there is communication to/from USB involved. Would it need to be compiled on the IBM clone or would it just work?
Several things; first, the term 'transfer' is nebulous...could mean FTP, SCP, SFTP, NFS, Samba, or any number of ways, including USB sticks or bluetooth. A C program is only code/ASCII text. Second, a compiled program for a Mac won't work on a PC, no matter what it's running...Mac OS isn't Linux or Windows. Programs for one are compiled on that platform, using that platforms libraries and drivers. Otherwise, why would companies have different versions for Mac, Windows, or Linux???
Copy the C source code over however you want. You will then have to compile it...and it *MIGHT* work. If it uses specialized Mac libraries that aren't present/available for whatever else you're compiling on, then it's up to you to either find those and install them, or in some cases, write your own work-arounds.
Also the term "IBM clone" is interesting. Are we talking an IBM Mainframe, IBM Midrange, IBM SP2, IBM PC, or perhaps an IBM Selectric Typewriter?
I am betting the IBM PC, but IBM has released a LOT of products over the years!
Although it would be an intriguing IBM Selectric clone that would run a C compiler....
Transferring source is just transferring text. If the target does not use EBCDIC you may not even need to translate.
The differences in the standard libraries might make porting a pain, but I have not tested to see how MUCH of a pain.
Can you expect it to work? Yes.
Without a LOT of fixing and translation to the compiler and library on the target machine? Probably not.
I mean, it IS possible, but seriously unlikely and the bigger the project the less likely it is to compile without issues.
This would be considered a "porting project".
If you are moving from "Intel iron" to "Intel iron," and are careful with your type definitions and compiler options, you can usually "port" an application from one compiler to another with a minimum of fuss. It's easier if the compiler that you want to use is available on both.
The gcc compiler [suite ...], for instance, does run on both platforms. There are various online tutorials which show you how to do it. But, Microsoft makes excellent compilers, too. In short, you have several good ways to approach this problem, and you should be successful.
Last edited by sundialsvcs; 03-31-2024 at 07:08 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.