2016-03-16 66 views
2

我想在iOS應用程序(Xcode項目)中使用現有的Pascal源代碼(無用戶界面)。所以我需要創建一個靜態庫,然後我可以添加到我的iOS項目。Delphi有可能爲iOS創建一個靜態庫嗎?

有沒有辦法在Delphi中爲臂架構創建一個靜態庫(* .a)?是否有編譯器/鏈接器選項?

或者也許有另一種方法可以做到這一點?

編輯:
我創建了一個OSX測試項目,並用於從DCP \ OSX32路徑的庫文件和手動創建的頭文件。

當我建立了Xcode項目我得到以下錯誤:

​​

脂說:

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 

的/路徑/ lib目錄/ TESTLIB。使用Delphi Package Project生成了一個文件。該文件似乎在Xcode項目中不可用。

+0

我目前正試圖解決相同的問題:將遺留的Delphi代碼編譯爲靜態或動態庫,以便在iOS應用程序中使用。你有沒有設法讓它工作? –

回答

2

documentation說這是可能的(以我的重點)。

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.
+0

謝謝,圖書館已經生成。但要在Xcode中使用它,我仍然需要一個頭文件。 Delphi可以創建它嗎? – Stefan

+0

我不相信它可以。我認爲你必須手動完成。 –