Recent

Author Topic: Can Pascal UNITs be included in a SwiftUI program?  (Read 462 times)

harlandh

  • Newbie
  • Posts: 1
Can Pascal UNITs be included in a SwiftUI program?
« on: July 28, 2019, 08:02:43 pm »
I have models and algorithms in Pascal UNITs that we want to use with a new user interface which is being written in SwiftUI for macOS and iOS.   

Is it possible to include just FPC UNITS  with other program structures,  instead of using a Pascal PROGRAM and UNITs linked to Objective-C/C++/C files?

Or, is the converse possible,  initializing the SwiftUI from the Pascal PROGRAM?

I hope this is a trivial question;  I do not have the actual environment running, yet.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 656
Re: Can Pascal UNITs be included in a SwiftUI program?
« Reply #1 on: July 28, 2019, 08:25:01 pm »
You can create a dynamic library that contains your Pascal code. This will ensure the necessary RTL units also get included _and_ initialized. See https://www.freepascal.org/docs-html/prog/progse55.html for more information (including the node about cdecl, which is very important).

Thaddy

  • Hero Member
  • *****
  • Posts: 8510
Re: Can Pascal UNITs be included in a SwiftUI program?
« Reply #2 on: July 29, 2019, 08:42:41 am »
I think libapl contains the full APL interpreter, to interface with a GUI, not any separate exports of its functionality, function-wise.
Can you give me an example of a functionality from APL that you can not express in Pascal? FreePascal supports many good vector libraries.

Btw: I know that notation-wise APL can be very dense, a Pascal equivalent is probably less dense, but possibly much faster since it is compiled to native code.
Recent improvements in array handling and low-level vector support in modern Pascal dialects would probably bridge the gap a bit.
« Last Edit: July 29, 2019, 08:46:58 am by Thaddy »
Read the manuals and if you are a professional get a proper education in computer science. Makes the forum a lot cleaner.