Embarcadero / octoid

Octoid is a tool for translating Objective-C headers into Delphi code. It is intended as a replacement for SDKTransform which ships with Delphi.
BSD 2-Clause "Simplified" License
29 stars 8 forks source link

Cannot create pas files #24

Open felixtool opened 7 months ago

felixtool commented 7 months ago

We would like to translate Objective-C headers into Delphi code. To achieve this task, we plan to use the Octoid tool developed by you. The environment is as follows: Operating System: Windows 11, RadStudio 11.3, LLVM 10 64bit. After installing LLVM 10.0 and compiling the UI App under RadStudio 11.3, we followed the steps exactly as explained in the “Intro Into Octoid” video. First we tried the BackgroundTasks framework, but it has the same issue as f.e. the Foundation framework.

The “Output” is:

Using arguments: -isystemC:\Users\mijomijo\Documents\Embarcadero\Studio\SDKs\iPhoneOS16.4.sdk\usr\include\ -isystemC:\Program Files\LLVM\lib\clang\10.0.0\include -FC:\Users\mijomijo\Documents\Embarcadero\Studio\SDKs\iPhoneOS16.4.sdk\System\Library\Frameworks\ -FC:\Users\mijomijo\Documents\Embarcadero\Studio\SDKs\iPhoneOS16.4sdk\System\Library\Frameworks\ -x objective-c -ferror-limit=50 -target arm-apple-darwin10 Parsing header files...

\System\Library\Frameworks/Foundation.framework/Headers/NSString.h:378:81: error: function does not return string type \System\Library\Frameworks/Foundation.framework/Headers/NSString.h:379:52: error: function does not return NSString \System\Library\Frameworks/Foundation.framework/Headers/NSString.h:394:53: error: function does not return NSString \System\Library\Frameworks/Foundation.framework/Headers/NSString.h:396:83: error: function does not return string type \System\Library\Frameworks/Foundation.framework/Headers/NSString.h:402:114: error: function does not return string type \System\Library\Frameworks/Foundation.framework/Headers/NSString.h:403:97: error: function does not return string type \System\Library\Frameworks/Foundation.framework/Headers/NSBundle.h:93:143: error: function does not return NSString \System\Library\Frameworks/Foundation.framework/Headers/NSURLSession.h:531:186: error: expected ')' Parsed header files with 8 error(s) Analyzing data types... As You can see, we run into header file parse errors, which are based on NS_FORMAT_ARGUMENT macro. If we are using a higher version of the libclang.dll (tested from version 14.0), the header parsing is successful, but we get EListError: Duplicates not allowed. All the tested units are from the standard Apple iOS SDK. We would appreciate your assistance in resolving this issue. In advance, thank you for the help!
kpheidrich commented 6 months ago

Regarding the error "Duplicates not allowed" my ticket #25 may be just that: a duplicate ;-) You could check, if it helps to get your header file translated.

DelphiWorlds commented 4 months ago

I'm not seeing these errors with the current Octoid code when performing an import for the Foundation framework for iOS, using v14.0.0 of libclang.dll. There are however known issues with importing this framework - if there are types not available in iOSapi.Foundation.pas (that ships with Delphi) that you wish to import, you may need to just extract them from the erroneous import and use them in your code.

If you're still unable to perform an import, I'll do one (from which you can extract the required types) and add it to this repo

I've filed this issue related to the erroneous import problem

DelphiWorlds commented 4 months ago

I've pushed a fix for the duplicates issue