Forum > iPhone/iPad

Can I create a library to use with XCODE?

(1/1)

laguna:
I would like to create a library for IOS (IPHONE) to be used within XCode for one of my projects using the INDY UDP components.

It can be done?

Do you have any examples from which I can start?

Thank you all.
Vincenzo

Jonas Maebe:
If you are allowed to use dynamic libraries in iOS projects these days, you can just compile a library like on any other platform and use that.

If Apple still does not allow that, you have to create a static library. FPC has no direct support for this. You can manually do it by compiling a dynamic library with the -Cn option. Then look at the generated link.res file, and create a static library from all *.o files mentioned in that file using the "ar" utility. The resulting static library can be linked against a C program.

Note that you can only link one static FPC library against a C program (because otherwise you will have two copies of the system unit, the initialisation code etc).

laguna:
Where can I find an example, and a guide?

Thanks for all.

Jonas Maebe:
I don't think there are any guides or examples.

Phil:

--- Quote from: laguna on March 24, 2018, 09:53:52 am ---I would like to create a library for IOS (IPHONE) to be used within XCode for one of my projects using the INDY UDP components.

--- End quote ---

You would create a framework, which is a dynamic library in a bundle structure that has a .framework extension. You copy the framework into your app bundle's Frameworks folder, either with a script or let Xcode do it.

https://developer.apple.com/library/content/technotes/tn2435/_index.html

Use Xcode to create an iOS framework project and look at the .framework structure - it's much simpler than a macOS .framework.

Frameworks are typically how third party software libraries are integrated into macOS and iOS apps. For example, Mapbox.framework is what you would include in your macOS and iOS apps:

https://www.mapbox.com/ios-sdk/

I doubt if Indy works on iOS. In any case, Indy, Synapse and FPC's HTTP client all use OpenSSL, which is not available or supported on iOS (and deprecated for years on macOS).

https://developer.apple.com/library/content/documentation/Security/Conceptual/cryptoservices/SecureNetworkCommunicationAPIs/SecureNetworkCommunicationAPIs.html#//apple_ref/doc/uid/TP40011172-CH13-SW3

Navigation

[0] Message Index

Go to full version