Recent

Author Topic: Can I create a library to use with XCODE?  (Read 7945 times)

laguna

  • Sr. Member
  • ****
  • Posts: 323
Can I create a library to use with XCODE?
« 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.

It can be done?

Do you have any examples from which I can start?

Thank you all.
Vincenzo

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
Re: Can I create a library to use with XCODE?
« Reply #1 on: March 24, 2018, 01:44:25 pm »
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

  • Sr. Member
  • ****
  • Posts: 323
Re: Can I create a library to use with XCODE?
« Reply #2 on: March 24, 2018, 01:57:42 pm »
Where can I find an example, and a guide?

Thanks for all.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
Re: Can I create a library to use with XCODE?
« Reply #3 on: March 24, 2018, 02:06:47 pm »
I don't think there are any guides or examples.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Can I create a library to use with XCODE?
« Reply #4 on: March 24, 2018, 03:46:27 pm »
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.

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


 

TinyPortal © 2005-2018