LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Transferring a C program from a Mac to an IBM clone (https://www.linuxquestions.org/questions/programming-9/transferring-a-c-program-from-a-mac-to-an-ibm-clone-4175735466/)

PsychoHermit 03-29-2024 03:45 PM

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?

Thanks,
--glenn

TB0ne 03-29-2024 04:04 PM

Quote:

Originally Posted by PsychoHermit (Post 6492780)
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.

PsychoHermit 03-29-2024 04:06 PM

That's what I was thinking, than you very much.

--glenn

wpeckham 03-29-2024 04:16 PM

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.

PsychoHermit 03-29-2024 04:25 PM

Yes, an IBM Compatible PC. AMD_64 I'm guessing.

Thanks,
--glenn

wpeckham 03-29-2024 07:26 PM

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".

sundialsvcs 03-30-2024 05:03 PM

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.

PsychoHermit 03-30-2024 05:10 PM

I won't be the one doing the porting but I will pass that on to the guy doing the work.

Thank you,
--glenn

sundialsvcs 03-31-2024 07:03 AM

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.

PsychoHermit 03-31-2024 07:52 AM

OK

Thank you,
--glenn

dugan 03-31-2024 09:40 AM

Assuming you’re copying the C source code over and compiling it: the answer is “maybe; try it.”

If you’re copying the compiled binary over, then the answer is no.

PsychoHermit 03-31-2024 10:35 AM

Yeah, as soon as the computer is available. Another guy is looking at it at the moment.

Thanks,
--glenn


All times are GMT -5. The time now is 04:46 AM.