简体   繁体   中英

Is it possible with Delphi to create a static library for iOS?

I would like to use existing Pascal source (no user interface) in an iOS app (Xcode project). So I need to create a static library, which I can then add to my iOS project.

Is there a way to create a static library (*.a) for the arm architecture within Delphi? Is there a compiler/linker option?

Or maybe there's another way to do this?

Edit:
I created a osx test project and used the library file from Dcp\\OSX32 path and manually created the header file.

When I build the Xcode project I get the following error:

ld: warning: ignoring file /Path/lib/testlib.a, file was built for archive which is not the architecture being linked (x86_64): /Path/lib/testlib.a

lipo says:

lipo -info /Path/lib/testlib.a  fatal error:
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo:
> archive with no architecture specification: /Path/lib/testlib.a (can't
> determine architecture for it)

ar:

ar -t /Path/lib/testlib.a  
/  
//  
/1

The /Path/lib/testlib.a file was generated with a Delphi Package Project. The file seems not usable in an Xcode project.

The documentation says that this is possible (with my emphasis).

RAD Studio generates a package static library file:

  • When you build a Delphi package for iOS Device or Android.
  • When you build a Delphi package for a desktop platform and you use the "Generate all C++Builder files (including package libs)" value for the C/C++ Output file generation option in Project > Options > Delphi Compiler > Output - C/C++.
  • When you build a C++ package and you enable the Generate static package library (.lib) option in Project > Options > C++ Linker.

A package static library file is a static library file generated from a package. You use a static library in place of an import library when your application does not use run-time packages. See Building Static Packages.

The file name of your package static library file is:

  • <package>.lib for 32-bit Windows.
  • <package>.a for 64-bit Windows and Mac OS X.
  • lib<package>.a for iOS Device and Android.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM