Hi All,
I have seen that quite a few functions of
DiskArbitration and IOKit have been implemented.
Using both I have succeeded in pulling up all kinds of disk information.
Now I'd like to use functions
DADiskUnmount,
DADiskMount,
DADiskEject,
DARegisterDiskAppearedCallback,
DARegisterDiskDisappearedCallback etc.
Some of the DiskArbitration functions (like DADiskCreateFromBSDName, DADiskGetBSDName, etc) have already been implemented (DADisk.pas and DASession.pas in
fpc/pacakages/univint), but some of the functions I'd like to use have not been "implemented" yet.
Since I'm very unfamiliar with bringing in functions like this, and/or how to create a wrapper for DiskArbitration.h, I was wondering if anyone would be willing to help with this.
I have been looking online, and been experimenting with creating my own, but without any luck.
Example:
extern void DADiskEject( DADiskRef disk,
DADiskEjectOptions options,
DADiskEjectCallback __nullable callback,
void * __nullable context );
/*!
* @typedef DADiskEjectApprovalCallback
* @abstract Type of the callback function used by DARegisterDiskEjectApprovalCallback().
* @param disk A disk object.
* @param context The user-defined context parameter given to the registration function.
* @result A dissenter reference. Pass NULL to approve.
* @discussion
* The caller of this callback receives a reference to the returned object. The
* caller also implicitly retains the object and is responsible for releasing it
* with CFRelease().
*/
On of my attempts was:
procedure DADiskEject(disk:DADiskRef; options:UInt32; callback:UnivPtr; context:UnivPtrPtr); external name '_DADiskEject';
For those experienced with creating wrappers, you'll probably see that things aren't perfect, caused by my inexperience with this.
Any help would be appreciated, even if it's just pointers in the right direction.
For example;
- are there any tools out there to convert Objective-C to pascal? (with or without the need to manual correct a few things)
- is there any documentation available how this should be done the right way?