Page 1 of 1

is it possible to call CarbonFramework or even C?

PostPosted: Sat Apr 17, 2010 11:49 am
by udo.killermann
the question says it all ;)
I would like to call some functions of the IOHID family. Since these are pure C declerations (example below) and there is such a thing as toll free bridging between Cocoa and Carbon for certain data types, I am wondering if such things are possible without implementing a Cocoa helper class in Objective-C.
Code: Select all
Boolean HIDBuildMultiDeviceList(const UInt32 *inUsagePages, const UInt32 *inUsages, int inNumDeviceTypes)


Thanks for your help again
Udo

Re: is it possible to call CarbonFramework or even C?

PostPosted: Mon Apr 19, 2010 12:50 pm
by berndnoetscher
udo.killermann wrote:the question says it all ;)
I would like to call some functions of the IOHID family. Since these are pure C declerations (example below) and there is such a thing as toll free bridging between Cocoa and Carbon for certain data types, I am wondering if such things are possible without implementing a Cocoa helper class in Objective-C.
Code: Select all
Boolean HIDBuildMultiDeviceList(const UInt32 *inUsagePages, const UInt32 *inUsages, int inNumDeviceTypes)


Thanks for your help again
Udo


Well, support for this would be possible. But there need to be more declare statements:
Code: Select all
Declare Framework "IOKit" optionalbinarypath, optionalheaderpath
Declare Lib "clib" optionalbinarypath, optionalheaderpath

would allow the following declare
Declare Function "IOKit" Boolean HIDBuildMultiDeviceList( const UInt32 *inUsagePages, const UInt32 *inUsages, int inNumDeviceTypes );

Will add these feature in the next version. It will be difficult to handle all those possible new data types...


Re: is it possible to call CarbonFramework or even C?

PostPosted: Wed Aug 04, 2010 7:24 pm
by berndnoetscher
It is possible to include objc code and frameworks now, so it is possible to call carbon code as well.