Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using a Pascal Library in XCode

I am developing an iOS app (OSX 10.7.4, XCode 4.3.3, and targeting iOS version 5.1). I have the interface already built, but the core functions the app will be using are written in Pascal. Rather than porting the Pascal functions to C (and having to maintain two copies), I was looking for a way to create a Pascal library that can be imported into XCode and called by the Objective-C code.

The Pascal functions are nothing more than calculations (no interface code, etc.). An example of how I would like it to work would go something like: the user pushes a button, the Objective-C code collects the entered data, the appropriate Pascal calculating function is called, and then the result is returned and displayed--Pascal only being used to provide the result.

I found FreePascal, and am assuming that is where I would start, but I have not been able to find any clear information regarding how to accomplish what I want to do. I also found this walkthrough, but the end result is that you can use Pascal to actually write your applications--which seems like overkill compared to what I need.

My question is: what is the the easiest way to use my core Pascal functions within my already built iOS app? Is integrating FreePascal into XCode and importing my current application storyboard and code into one of the Pascal templates absolutely necessary, or is it possible to create a compatible Pascal library using another method and reference it from my code?

I would very grateful for any help provided (even just a link). I've done a lot of searching, and would really like to get this problem solved.

like image 509
Daniel Hopkins Avatar asked May 02 '26 23:05

Daniel Hopkins


1 Answers

The simplest mechanism is to create a pascal Static Library and include it in the Objective-C iOS project, otherwise you would have to integrated the build process into the xcode environment; which is a little bit more work rather than just exposing the API via a header and then linking to the .a file.

like image 174
Petesh Avatar answered May 04 '26 12:05

Petesh