Recent

Author Topic: Can Pascal UNITs be included in a SwiftUI program?  (Read 2057 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: 1059
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: 14373
  • Sensorship about opinions does not belong here.
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 »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

yazzdi

  • New Member
  • *
  • Posts: 16
Re: Can Pascal UNITs be included in a SwiftUI program?
« Reply #3 on: August 30, 2019, 06:58:16 pm »
> 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.


Could you elaborate, for benefit of someone new to iOS programming using Pascal? Are you referring to creating the entire program in Pascal for use on iOS, and having full access to all features available to a swift program (albeit without premade swift  object libraries etc). Is there an example of a sophisticated iOS program done entirely in Pascal?

 

TinyPortal © 2005-2018