Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2022-09

M1 and Mac system support?

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Richard Hyman

All,

I have a couple of questions WRT FPC on the Mac. I have tried searching archives without success. I hope this is the right place to ask.

I am trying to help a friend (a mathematician) to run an app he wrote using FPC. He needs to run a lot of instances of his app (8 hours per run), and he wants to be able to run multiple instances simultaneously under system control.

1. Does FPC compile natively for the ARM Macs, specifically an M1? Docs I found do not directly answer this question (he's thinking about purchasing an M1 Mac mini).

2. Does FPC provide any support for interfacing to the system?

a. Can an FPC compiled app be run from the terminal with recognition of input parameters (standard I/O). E.G. run something such as "myApp /../myInputFile.txt /../myOutputFile.txt", and have the app parse $1 and $2 for the input and output files?

If FPC supports standard I/O, how is it accomplished within the app?

b. Does FPC support Mac system APIs? This is a general question since API support in any one of several areas (beyond graphics for example) would be beneficial.

TIA!
Rhyman

Reply by email

Sven Barth
to Richard Hyman

Richard Hyman via fpc-devel schrieb am
Do., 22. Sep. 2022, 09:00:

Show quoted text 5 lines
1. Does FPC compile natively for the ARM Macs, specifically an M1? Docs I found do not directly answer this question (he's thinking about purchasing an M1 Mac mini).

This is supported since 3.2.2.

2. Does FPC provide any support for interfacing to the system?

Aside from interfacing through the C API FPC can also interact with Objective C objects.

Show quoted text 5 lines
a. Can an FPC compiled app be run from the terminal with recognition of input parameters (standard I/O). E.G. run something such as "myApp /../myInputFile.txt /../myOutputFile.txt", and have the app parse $1 and $2 for the input and output files?

You can access parameter values using the ParamStr functions and then you need to open the files with the file APilI of your choice.

If FPC supports standard I/O, how is it accomplished within the app?

FPC supports the standard Pascal I/O using Assign, Read, Write and friends, an imperative style FileOpen, FileRead, FileWrite API as well as the TStream based API.

b. Does FPC support Mac system APIs? This is a general question since API support in any one of several areas (beyond graphics for example) would be beneficial.

Since FPC can interact with the system as mentioned above, it does. A unit with various converted API headers is provided.

Just look at what Lazarus can do. It's a native macOS application and without interfacing with the macOS API this wouldn't be possible.

Regards,
Sven

Reply by email

Richard Hyman
to Sven Barth

Sven,

Thank you very much for your quick and cogent reply!

best wishes,
Rhyman

AM Sven Barth wrote 52 lines
Richard Hyman via fpc-devel schrieb am Do., 22. Sep. 2022, 09:00: > > 1. Does FPC compile natively for the ARM Macs, specifically an M1? Docs > I found do not directly answer this question (he's thinking about > purchasing an M1 Mac mini). > This is supported since 3.2.2. 2. Does FPC provide any support for interfacing to the system? > Aside from interfacing through the C API FPC can also interact with Objective C objects. > a. Can an FPC compiled app be run from the terminal with recognition of > input parameters (standard I/O). E.G. run something such as "myApp > /../myInputFile.txt /../myOutputFile.txt", and have the app parse $1 and > $2 for the input and output files? > You can access parameter values using the ParamStr functions and then you need to open the files with the file APilI of your choice. > If FPC supports standard I/O, how is it accomplished within the app? > FPC supports the standard Pascal I/O using Assign, Read, Write and friends, an imperative style FileOpen, FileRead, FileWrite API as well as the TStream based API. > b. Does FPC support Mac system APIs? This is a general question since > API support in any one of several areas (beyond graphics for example) would > be beneficial. > Since FPC can interact with the system as mentioned above, it does. A unit with various converted API headers is provided. Just look at what Lazarus can do. It's a native macOS application and without interfacing with the macOS API this wouldn't be possible. Regards, Sven >

Reply by email

Hairy Pixels
to Richard Hyman: I have a couple of questions WRT FPC on the Mac. I have tried searching archives without…
On Sep 22, 2022, at 6:52 AM, Richard Hyman via fpc-devel wrote: b. Does FPC support Mac system APIs? This is a general question since API support in any one of several areas (beyond graphics for example) would be beneficial.

What system APIs? Many frameworks are not ported to Objective Pascal syntax so it really depends what you’re trying to do.

Come to think of it but there may be Swift-only frameworks starting to appear and I don’t know how/if they would be supported in FPC….

Regards,
Ryan Joseph

Reply by email