Delphi implementation of missing iOS frameworks

If you develop for iOS or Mac under Delphi XE-5 you will find out sooner or later that Embarcadero is not giving you access to all frameworks that iOS or Mac has.

I found out that by trying to implement the MIDI. iOS have very good support to play MIDI, but you can’t use it from the Delphi. But there is a way how you can add it.

XCode gives headers of all frameworks. They are stored at your Mac under /Applications/<version>

Screen Shot 2013-12-10 at 01.00.27

I created tool to convert the .h files to .pas.

To use each of the framework you need to do following:

1) Download the PAS code for framework that you want to use from my pages.

2) Copy the framework code from Mac to your PC where you has Delphi to path: c:\Users\your username>\Documents\RAD Studio\SDKs\<Version>\System\Library\Frameworks\ (the path can be different per installation and version of your OS, but you will find it).

You need the code from Mac only for deployment to real device. if you target the simulator, it’s not needed.

if you are missing some framework, please let me know, I’ll try build it for you. Once I’ll feel that my conversion tool is ready to be used by someone else, I’ll release it too.

I’m warning you! The conversion is done by my tool that I wrote over night. There may be some terrible mistakes that I didn’t found. I’m giving my work out for free. In exchange I need from you to check it and let me know if you found any problem. The best would be of course if you will correct the unit and send me back what you did.

If you want to get updates about new version, give me comment with you mail address and I’ll send you mail when I’ll publish new version.

Thank you for your help!

I’m going to add more units as I’ll build them or as people will ask me.

iOS/Mac Framework Name Link to download Converted Tested
 CoreAudio iOSapi.CoreAudioTypes P/J on 10. Dec 2013
 CoreMidi iOSapi.CoreMidi P/J on 10. Dec 2013
 AudioUnit iOSapi.AudioUnit P/J on 10. Dec 2013 works only on simulator!
 AudioToolbox iOSapi.AudioToolbox P/J on 10. Dec 2013 Because of relation to AudioUnit works only on simulator!

Now little bit about the conversion tool.

I write this tool as I didn’t want to convert the code manually. It would be lot of work and of course there will be lot of mistakes.

I was using two sources

1) the existing Delphi’s unit implementing iOS frameworks compared to the original .h files

2) This brilliant analyze describing how to convert from C to Delphi. Especially for conversion of the arrays and unions. Thank you Rudy!!

Currently I can convert the regular C code not the ObjectiveC because my target is the MIDI and those are written under .h.

My conversion tool is tested only on the Apple’s .h units so it does expect certain pattern. It may not work with any .h unit, but on other hand this can be added.

Enjoy my work.


  1. sdpz says:

    I need this framework, please help.


    Thank you P.J.Strnad!

    • pjstrnad says:

      Sorry I tried to export this unit but it’s somehow complicated.

      I couldn’t figure how to convert this code:

      typedef unsigned char vUInt8 __attribute__((__vector_size__(16)));

      and then I have problem with this:
      typedef VIMAGE_CHOICE_ENUM(vImage_Error, ssize_t)
      kvImageNoError = 0,
      kvImageRoiLargerThanInputBuffer = -21766,
      kvImageInvalidKernelSize = -21767,
      kvImageInvalidEdgeStyle = -21768,
      kvImageInvalidOffset_X = -21769,
      kvImageInvalidOffset_Y = -21770,
      kvImageMemoryAllocationError = -21771,
      kvImageNullPointerArgument = -21772,
      kvImageInvalidParameter = -21773,
      kvImageBufferSizeMismatch = -21774,
      kvImageUnknownFlagsBit = -21775,
      kvImageInternalError = -21776, /* Should never see this. File a bug! */
      kvImageInvalidRowBytes = -21777,
      kvImageInvalidImageFormat = -21778,
      kvImageColorSyncIsAbsent = -21779,
      kvImageOutOfPlaceOperationRequired = -21780

      Do you have any idea how to write that at Delphi?

Leave a Reply

Your email address will not be published. Required fields are marked *